R set up

Script not shown in the HTML file.

Note that the data cleaning and exploration for this analysis is in a separate file called written by Hedyeh Ahmadi.

## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.1     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ ggplot2   3.4.2     ✔ tibble    3.2.1
## ✔ lubridate 1.9.2     ✔ tidyr     1.3.0
## ✔ purrr     1.0.1     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter()     masks stats::filter()
## ✖ dplyr::group_rows() masks kableExtra::group_rows()
## ✖ dplyr::lag()        masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
## ------------------------------------------------------------------------------
## 
## You have loaded plyr after dplyr - this is likely to cause problems.
## If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
## library(plyr); library(dplyr)
## 
## ------------------------------------------------------------------------------
## 
## 
## Attaching package: 'plyr'
## 
## 
## The following objects are masked from 'package:dplyr':
## 
##     arrange, count, desc, failwith, id, mutate, rename, summarise,
##     summarize
## 
## 
## The following object is masked from 'package:purrr':
## 
##     compact
## 
## 
## 
## Attaching package: 'scales'
## 
## 
## The following object is masked from 'package:purrr':
## 
##     discard
## 
## 
## The following object is masked from 'package:readr':
## 
##     col_factor
## 
## 
## 
## Attaching package: 'ggpubr'
## 
## 
## The following object is masked from 'package:plyr':
## 
##     mutate
## 
## 
## 
## Attaching package: 'matrixStats'
## 
## 
## The following object is masked from 'package:plyr':
## 
##     count
## 
## 
## The following object is masked from 'package:dplyr':
## 
##     count
## 
## 
## Loading required package: Matrix
## 
## 
## Attaching package: 'Matrix'
## 
## 
## The following objects are masked from 'package:tidyr':
## 
##     expand, pack, unpack
## 
## 
## 
## Attaching package: 'nlme'
## 
## 
## The following object is masked from 'package:lme4':
## 
##     lmList
## 
## 
## The following object is masked from 'package:dplyr':
## 
##     collapse
## 
## 
## 
## Attaching package: 'lmerTest'
## 
## 
## The following object is masked from 'package:lme4':
## 
##     lmer
## 
## 
## The following object is masked from 'package:stats':
## 
##     step
## 
## 
## Loading required package: HLMdiag
## 
## 
## Attaching package: 'HLMdiag'
## 
## 
## The following object is masked from 'package:stats':
## 
##     covratio
## 
## 
## 
## Attaching package: 'Hmisc'
## 
## 
## The following object is masked from 'package:e1071':
## 
##     impute
## 
## 
## The following objects are masked from 'package:plyr':
## 
##     is.discrete, summarize
## 
## 
## The following objects are masked from 'package:dplyr':
## 
##     src, summarize
## 
## 
## The following objects are masked from 'package:xtable':
## 
##     label, label<-
## 
## 
## The following objects are masked from 'package:base':
## 
##     format.pval, units
## 
## 
## 
## Attaching package: 'doBy'
## 
## 
## The following object is masked from 'package:dplyr':
## 
##     order_by
## 
## 
## 
## Attaching package: 'rockchalk'
## 
## 
## The following object is masked from 'package:Hmisc':
## 
##     summarize
## 
## 
## The following objects are masked from 'package:e1071':
## 
##     kurtosis, skewness
## 
## 
## The following object is masked from 'package:plyr':
## 
##     summarize
## 
## 
## The following object is masked from 'package:dplyr':
## 
##     summarize
## 
## 
## 
## Attaching package: 'MASS'
## 
## 
## The following object is masked from 'package:rockchalk':
## 
##     mvrnorm
## 
## 
## The following object is masked from 'package:dplyr':
## 
##     select
## 
## 
## 
## Attaching package: 'psych'
## 
## 
## The following object is masked from 'package:Hmisc':
## 
##     describe
## 
## 
## The following objects are masked from 'package:scales':
## 
##     alpha, rescale
## 
## 
## The following objects are masked from 'package:ggplot2':
## 
##     %+%, alpha
## 
## 
## corrplot 0.92 loaded
## 
## Loading required package: carData
## 
## 
## Attaching package: 'car'
## 
## 
## The following object is masked from 'package:psych':
## 
##     logit
## 
## 
## The following object is masked from 'package:dplyr':
## 
##     recode
## 
## 
## The following object is masked from 'package:purrr':
## 
##     some
## 
## 
## Loading required package: survival
## 
## 
## Attaching package: 'performance'
## 
## 
## The following object is masked from 'package:xtable':
## 
##     display
## 
## 
## 
## Attaching package: 'arsenal'
## 
## 
## The following object is masked from 'package:Hmisc':
## 
##     %nin%
## 
## 
## The following object is masked from 'package:matrixStats':
## 
##     iqr
## 
## 
## The following object is masked from 'package:scales':
## 
##     ordinal
## 
## 
## The following object is masked from 'package:lubridate':
## 
##     is.Date
## 
## 
## 
## Attaching package: 'NBZIMM'
## 
## 
## The following object is masked from 'package:psych':
## 
##     sim
## 
## 
## The following object is masked from 'package:stringr':
## 
##     fixed
## 
## 
## 
## Attaching package: 'philentropy'
## 
## 
## The following objects are masked from 'package:psych':
## 
##     distance, manhattan, minkowski

Importing the Clean Data

HEI_Aim2_Long <- read.csv("HEI_Aim2_Long.csv")
HEI_Aim2_Wide <- read.csv("HEI_Aim2_Wide.csv")

HEI_Aim2_Long_1KidPerFamily <- read.csv("HEI_Aim2_Long_1KidPerFamily.csv")
dim(HEI_Aim2_Long)
## [1] 30419    56
dim(HEI_Aim2_Wide)
## [1] 11866   140
dim(HEI_Aim2_Long_1KidPerFamily)
## [1] 25125    56
names(HEI_Aim2_Long)
##  [1] "X"                               "subjectid"                      
##  [3] "rel_family_id"                   "abcd_site"                      
##  [5] "eventname"                       "rel_relationship"               
##  [7] "interview_date"                  "demo_l_p_select_language___1"   
##  [9] "cbcl_select_language___1"        "rel_group_id"                   
## [11] "rel_ingroup_order"               "rel_same_sex"                   
## [13] "reshist_addr1_pm252016aa"        "sex"                            
## [15] "interview_age"                   "race_ethnicity"                 
## [17] "high.educ"                       "reshist_addr1_adi_perc"         
## [19] "reshist_addr1_adi_wsum"          "overall.income.b"               
## [21] "overall.income.l"                "overall.income.alltp"           
## [23] "prnt.empl.bl"                    "prnt.empl.l"                    
## [25] "prnt.empl.alltp"                 "neighb_phenx_avg_p"             
## [27] "neighb_phenx_sum_p"              "reshist_addr1_popdensity"       
## [29] "reshist_addr1_proxrd"            "married"                        
## [31] "married.or.livingtogether"       "cbcl_scr_syn_internal_r"        
## [33] "cbcl_scr_syn_external_r"         "cbcl_scr_syn_totprob_r"         
## [35] "cbcl_scr_syn_anxdep_r"           "cbcl_scr_syn_withdep_r"         
## [37] "cbcl_scr_syn_attention_r"        "cbcl_scr_syn_rulebreak_r"       
## [39] "cbcl_scr_syn_aggressive_r"       "cbcl_scr_syn_internal_t"        
## [41] "cbcl_scr_syn_external_t"         "cbcl_scr_syn_totprob_t"         
## [43] "cbcl_scr_syn_anxdep_t"           "cbcl_scr_syn_withdep_t"         
## [45] "cbcl_scr_syn_attention_t"        "cbcl_scr_syn_rulebreak_t"       
## [47] "cbcl_scr_syn_aggressive_t"       "reshist_addr1_years"            
## [49] "income_midp"                     "demo_comb_income_v2"            
## [51] "reshist_addr1_no2_2016_aavg"     "reshist_addr1_o3_2016_annavg"   
## [53] "reshist_addr1_pm252016aa_bl"     "reshist_addr1_no2_2016_aavg_bl" 
## [55] "reshist_addr1_o3_2016_annavg_bl" "high.educ_bl"
names(HEI_Aim2_Wide)
##   [1] "X"                                    
##   [2] "subjectid"                            
##   [3] "rel_family_id"                        
##   [4] "rel_group_id"                         
##   [5] "rel_same_sex"                         
##   [6] "sex"                                  
##   [7] "race_ethnicity"                       
##   [8] "reshist_addr1_pm252016aa.Baseline"    
##   [9] "abcd_site.Baseline"                   
##  [10] "interview_date.Baseline"              
##  [11] "rel_relationship.Baseline"            
##  [12] "rel_ingroup_order.Baseline"           
##  [13] "high.educ.Baseline"                   
##  [14] "interview_age.Baseline"               
##  [15] "demo_l_p_select_language___1.Baseline"
##  [16] "cbcl_select_language___1.Baseline"    
##  [17] "reshist_addr1_adi_perc.Baseline"      
##  [18] "reshist_addr1_adi_wsum.Baseline"      
##  [19] "overall.income.b.Baseline"            
##  [20] "overall.income.l.Baseline"            
##  [21] "overall.income.alltp.Baseline"        
##  [22] "prnt.empl.bl.Baseline"                
##  [23] "prnt.empl.l.Baseline"                 
##  [24] "prnt.empl.alltp.Baseline"             
##  [25] "neighb_phenx_avg_p.Baseline"          
##  [26] "neighb_phenx_sum_p.Baseline"          
##  [27] "reshist_addr1_popdensity.Baseline"    
##  [28] "reshist_addr1_proxrd.Baseline"        
##  [29] "married.Baseline"                     
##  [30] "married.or.livingtogether.Baseline"   
##  [31] "cbcl_scr_syn_internal_r.Baseline"     
##  [32] "cbcl_scr_syn_external_r.Baseline"     
##  [33] "cbcl_scr_syn_totprob_r.Baseline"      
##  [34] "cbcl_scr_syn_anxdep_r.Baseline"       
##  [35] "cbcl_scr_syn_withdep_r.Baseline"      
##  [36] "cbcl_scr_syn_attention_r.Baseline"    
##  [37] "cbcl_scr_syn_rulebreak_r.Baseline"    
##  [38] "cbcl_scr_syn_aggressive_r.Baseline"   
##  [39] "cbcl_scr_syn_internal_t.Baseline"     
##  [40] "cbcl_scr_syn_external_t.Baseline"     
##  [41] "cbcl_scr_syn_totprob_t.Baseline"      
##  [42] "cbcl_scr_syn_anxdep_t.Baseline"       
##  [43] "cbcl_scr_syn_withdep_t.Baseline"      
##  [44] "cbcl_scr_syn_attention_t.Baseline"    
##  [45] "cbcl_scr_syn_rulebreak_t.Baseline"    
##  [46] "cbcl_scr_syn_aggressive_t.Baseline"   
##  [47] "reshist_addr1_years.Baseline"         
##  [48] "income_midp.Baseline"                 
##  [49] "demo_comb_income_v2.Baseline"         
##  [50] "reshist_addr1_no2_2016_aavg.Baseline" 
##  [51] "reshist_addr1_o3_2016_annavg.Baseline"
##  [52] "reshist_addr1_pm252016aa.1.year"      
##  [53] "abcd_site.1.year"                     
##  [54] "interview_date.1.year"                
##  [55] "rel_relationship.1.year"              
##  [56] "rel_ingroup_order.1.year"             
##  [57] "high.educ.1.year"                     
##  [58] "interview_age.1.year"                 
##  [59] "demo_l_p_select_language___1.1.year"  
##  [60] "cbcl_select_language___1.1.year"      
##  [61] "reshist_addr1_adi_perc.1.year"        
##  [62] "reshist_addr1_adi_wsum.1.year"        
##  [63] "overall.income.b.1.year"              
##  [64] "overall.income.l.1.year"              
##  [65] "overall.income.alltp.1.year"          
##  [66] "prnt.empl.bl.1.year"                  
##  [67] "prnt.empl.l.1.year"                   
##  [68] "prnt.empl.alltp.1.year"               
##  [69] "neighb_phenx_avg_p.1.year"            
##  [70] "neighb_phenx_sum_p.1.year"            
##  [71] "reshist_addr1_popdensity.1.year"      
##  [72] "reshist_addr1_proxrd.1.year"          
##  [73] "married.1.year"                       
##  [74] "married.or.livingtogether.1.year"     
##  [75] "cbcl_scr_syn_internal_r.1.year"       
##  [76] "cbcl_scr_syn_external_r.1.year"       
##  [77] "cbcl_scr_syn_totprob_r.1.year"        
##  [78] "cbcl_scr_syn_anxdep_r.1.year"         
##  [79] "cbcl_scr_syn_withdep_r.1.year"        
##  [80] "cbcl_scr_syn_attention_r.1.year"      
##  [81] "cbcl_scr_syn_rulebreak_r.1.year"      
##  [82] "cbcl_scr_syn_aggressive_r.1.year"     
##  [83] "cbcl_scr_syn_internal_t.1.year"       
##  [84] "cbcl_scr_syn_external_t.1.year"       
##  [85] "cbcl_scr_syn_totprob_t.1.year"        
##  [86] "cbcl_scr_syn_anxdep_t.1.year"         
##  [87] "cbcl_scr_syn_withdep_t.1.year"        
##  [88] "cbcl_scr_syn_attention_t.1.year"      
##  [89] "cbcl_scr_syn_rulebreak_t.1.year"      
##  [90] "cbcl_scr_syn_aggressive_t.1.year"     
##  [91] "reshist_addr1_years.1.year"           
##  [92] "income_midp.1.year"                   
##  [93] "demo_comb_income_v2.1.year"           
##  [94] "reshist_addr1_no2_2016_aavg.1.year"   
##  [95] "reshist_addr1_o3_2016_annavg.1.year"  
##  [96] "reshist_addr1_pm252016aa.2.year"      
##  [97] "abcd_site.2.year"                     
##  [98] "interview_date.2.year"                
##  [99] "rel_relationship.2.year"              
## [100] "rel_ingroup_order.2.year"             
## [101] "high.educ.2.year"                     
## [102] "interview_age.2.year"                 
## [103] "demo_l_p_select_language___1.2.year"  
## [104] "cbcl_select_language___1.2.year"      
## [105] "reshist_addr1_adi_perc.2.year"        
## [106] "reshist_addr1_adi_wsum.2.year"        
## [107] "overall.income.b.2.year"              
## [108] "overall.income.l.2.year"              
## [109] "overall.income.alltp.2.year"          
## [110] "prnt.empl.bl.2.year"                  
## [111] "prnt.empl.l.2.year"                   
## [112] "prnt.empl.alltp.2.year"               
## [113] "neighb_phenx_avg_p.2.year"            
## [114] "neighb_phenx_sum_p.2.year"            
## [115] "reshist_addr1_popdensity.2.year"      
## [116] "reshist_addr1_proxrd.2.year"          
## [117] "married.2.year"                       
## [118] "married.or.livingtogether.2.year"     
## [119] "cbcl_scr_syn_internal_r.2.year"       
## [120] "cbcl_scr_syn_external_r.2.year"       
## [121] "cbcl_scr_syn_totprob_r.2.year"        
## [122] "cbcl_scr_syn_anxdep_r.2.year"         
## [123] "cbcl_scr_syn_withdep_r.2.year"        
## [124] "cbcl_scr_syn_attention_r.2.year"      
## [125] "cbcl_scr_syn_rulebreak_r.2.year"      
## [126] "cbcl_scr_syn_aggressive_r.2.year"     
## [127] "cbcl_scr_syn_internal_t.2.year"       
## [128] "cbcl_scr_syn_external_t.2.year"       
## [129] "cbcl_scr_syn_totprob_t.2.year"        
## [130] "cbcl_scr_syn_anxdep_t.2.year"         
## [131] "cbcl_scr_syn_withdep_t.2.year"        
## [132] "cbcl_scr_syn_attention_t.2.year"      
## [133] "cbcl_scr_syn_rulebreak_t.2.year"      
## [134] "cbcl_scr_syn_aggressive_t.2.year"     
## [135] "reshist_addr1_years.2.year"           
## [136] "income_midp.2.year"                   
## [137] "demo_comb_income_v2.2.year"           
## [138] "reshist_addr1_no2_2016_aavg.2.year"   
## [139] "reshist_addr1_o3_2016_annavg.2.year"  
## [140] "rel_relationship.1_year"
names(HEI_Aim2_Long_1KidPerFamily)
##  [1] "X"                               "subjectid"                      
##  [3] "rel_family_id"                   "abcd_site"                      
##  [5] "eventname"                       "rel_relationship"               
##  [7] "interview_date"                  "demo_l_p_select_language___1"   
##  [9] "cbcl_select_language___1"        "rel_group_id"                   
## [11] "rel_ingroup_order"               "rel_same_sex"                   
## [13] "reshist_addr1_pm252016aa"        "sex"                            
## [15] "interview_age"                   "race_ethnicity"                 
## [17] "high.educ"                       "reshist_addr1_adi_perc"         
## [19] "reshist_addr1_adi_wsum"          "overall.income.b"               
## [21] "overall.income.l"                "overall.income.alltp"           
## [23] "prnt.empl.bl"                    "prnt.empl.l"                    
## [25] "prnt.empl.alltp"                 "neighb_phenx_avg_p"             
## [27] "neighb_phenx_sum_p"              "reshist_addr1_popdensity"       
## [29] "reshist_addr1_proxrd"            "married"                        
## [31] "married.or.livingtogether"       "cbcl_scr_syn_internal_r"        
## [33] "cbcl_scr_syn_external_r"         "cbcl_scr_syn_totprob_r"         
## [35] "cbcl_scr_syn_anxdep_r"           "cbcl_scr_syn_withdep_r"         
## [37] "cbcl_scr_syn_attention_r"        "cbcl_scr_syn_rulebreak_r"       
## [39] "cbcl_scr_syn_aggressive_r"       "cbcl_scr_syn_internal_t"        
## [41] "cbcl_scr_syn_external_t"         "cbcl_scr_syn_totprob_t"         
## [43] "cbcl_scr_syn_anxdep_t"           "cbcl_scr_syn_withdep_t"         
## [45] "cbcl_scr_syn_attention_t"        "cbcl_scr_syn_rulebreak_t"       
## [47] "cbcl_scr_syn_aggressive_t"       "reshist_addr1_years"            
## [49] "income_midp"                     "demo_comb_income_v2"            
## [51] "reshist_addr1_no2_2016_aavg"     "reshist_addr1_o3_2016_annavg"   
## [53] "reshist_addr1_pm252016aa_bl"     "reshist_addr1_no2_2016_aavg_bl" 
## [55] "reshist_addr1_o3_2016_annavg_bl" "high.educ_bl"
# Note we are keeping all families but choosing one kid per family
length(unique(HEI_Aim2_Long$rel_family_id))
## [1] 9844
length(unique(HEI_Aim2_Long$subjectid)) # matches number of rows of wide data :)
## [1] 11866
length(unique(HEI_Aim2_Long_1KidPerFamily$rel_family_id))
## [1] 9844
length(unique(HEI_Aim2_Long_1KidPerFamily$subjectid))
## [1] 9844

Copy baseline variables to all timepoints for full df

#rename so can use later
names(HEI_Aim2_Long)[names(HEI_Aim2_Long) == 'prnt.empl.bl'] <- 'prnt.empl.b'

#create dataset for table and comparison
baseline_vars <- subset(HEI_Aim2_Long, HEI_Aim2_Long$eventname=="Baseline", select = c("subjectid", "sex", "race_ethnicity", "high.educ", "neighb_phenx_avg_p", "overall.income.b", "prnt.empl.b"))

#rename variables
names(baseline_vars)[names(baseline_vars) == 'sex'] <- 'sex.bl'
names(baseline_vars)[names(baseline_vars) == 'race_ethnicity'] <- 'race_ethnicity.bl'
names(baseline_vars)[names(baseline_vars) == 'high.educ'] <- 'high.educ.bl'
names(baseline_vars)[names(baseline_vars) == 'neighb_phenx_avg_p'] <- 'neighb_phenx_avg_p.bl'
names(baseline_vars)[names(baseline_vars) == 'overall.income.b'] <- 'overall.income.bl'
names(baseline_vars)[names(baseline_vars) == 'prnt.empl.b'] <- 'prnt.empl.bl'

#add to initial df
HEI_Aim2_Long_2 <- merge(HEI_Aim2_Long, baseline_vars, by="subjectid")

Descriptive Table before Cleaning

#factor eventname
HEI_Aim2_Long_2$eventname <- as.factor(HEI_Aim2_Long_2$eventname)
HEI_Aim2_Long_2$eventname <- relevel(HEI_Aim2_Long_2$eventname , ref="Baseline")

#create smaller df
df_prior <- subset(HEI_Aim2_Long_2,select=c("subjectid","abcd_site","eventname","interview_age","reshist_addr1_pm252016aa_bl","prnt.empl.bl","overall.income.bl","sex.bl","race_ethnicity.bl","high.educ.bl","neighb_phenx_avg_p.bl","cbcl_scr_syn_internal_r","cbcl_scr_syn_external_r","cbcl_scr_syn_anxdep_r","cbcl_scr_syn_withdep_r","cbcl_scr_syn_attention_r","cbcl_scr_syn_rulebreak_r","cbcl_scr_syn_aggressive_r","cbcl_scr_syn_totprob_r"))
#create table
des_table_prior <- tableby(eventname ~ ., data = df_prior[ , -which(names(df_prior) %in% c("subjectid"))], total=F) 
summary(des_table_prior, title = "Descriptive Statistics by Eventname Before Cleaning")
## 
## 
## Table: Descriptive Statistics by Eventname Before Cleaning
## 
## |                                         | Baseline (N=11839) | 1-year (N=11200)  |  2-year (N=7334)  | p value|
## |:----------------------------------------|:------------------:|:-----------------:|:-----------------:|-------:|
## |**abcd_site**                            |                    |                   |                   | < 0.001|
## |&nbsp;&nbsp;&nbsp;site01                 |     406 (3.4%)     |    369 (3.3%)     |    210 (2.9%)     |        |
## |&nbsp;&nbsp;&nbsp;site02                 |     558 (4.7%)     |    548 (4.9%)     |    351 (4.8%)     |        |
## |&nbsp;&nbsp;&nbsp;site03                 |     631 (5.3%)     |    563 (5.0%)     |    372 (5.1%)     |        |
## |&nbsp;&nbsp;&nbsp;site04                 |     745 (6.3%)     |    727 (6.5%)     |    534 (7.3%)     |        |
## |&nbsp;&nbsp;&nbsp;site05                 |     378 (3.2%)     |    357 (3.2%)     |    234 (3.2%)     |        |
## |&nbsp;&nbsp;&nbsp;site06                 |     584 (4.9%)     |    568 (5.1%)     |    379 (5.2%)     |        |
## |&nbsp;&nbsp;&nbsp;site07                 |     339 (2.9%)     |    322 (2.9%)     |    116 (1.6%)     |        |
## |&nbsp;&nbsp;&nbsp;site08                 |     350 (3.0%)     |    339 (3.0%)     |    212 (2.9%)     |        |
## |&nbsp;&nbsp;&nbsp;site09                 |     433 (3.7%)     |    393 (3.5%)     |    227 (3.1%)     |        |
## |&nbsp;&nbsp;&nbsp;site10                 |     739 (6.2%)     |    708 (6.3%)     |    493 (6.7%)     |        |
## |&nbsp;&nbsp;&nbsp;site11                 |     450 (3.8%)     |    400 (3.6%)     |    197 (2.7%)     |        |
## |&nbsp;&nbsp;&nbsp;site12                 |     604 (5.1%)     |    550 (4.9%)     |    274 (3.7%)     |        |
## |&nbsp;&nbsp;&nbsp;site13                 |     728 (6.1%)     |    691 (6.2%)     |    443 (6.0%)     |        |
## |&nbsp;&nbsp;&nbsp;site14                 |     606 (5.1%)     |    583 (5.2%)     |    430 (5.9%)     |        |
## |&nbsp;&nbsp;&nbsp;site15                 |     458 (3.9%)     |    426 (3.8%)     |    266 (3.6%)     |        |
## |&nbsp;&nbsp;&nbsp;site16                 |    1011 (8.5%)     |    979 (8.7%)     |    640 (8.7%)     |        |
## |&nbsp;&nbsp;&nbsp;site17                 |     578 (4.9%)     |    562 (5.0%)     |    374 (5.1%)     |        |
## |&nbsp;&nbsp;&nbsp;site18                 |     384 (3.2%)     |    376 (3.4%)     |    223 (3.0%)     |        |
## |&nbsp;&nbsp;&nbsp;site19                 |     550 (4.6%)     |    521 (4.7%)     |    397 (5.4%)     |        |
## |&nbsp;&nbsp;&nbsp;site20                 |     707 (6.0%)     |    687 (6.1%)     |    528 (7.2%)     |        |
## |&nbsp;&nbsp;&nbsp;site21                 |     600 (5.1%)     |    531 (4.7%)     |    434 (5.9%)     |        |
## |**interview_age**                        |                    |                   |                   | < 0.001|
## |&nbsp;&nbsp;&nbsp;Mean (SD)              |  118.967 (7.495)   |  131.073 (7.714)  |  143.361 (7.747)  |        |
## |&nbsp;&nbsp;&nbsp;Range                  | 107.000 - 133.000  | 116.000 - 149.000 | 127.000 - 164.000 |        |
## |**reshist_addr1_pm252016aa_bl**          |                    |                   |                   |   0.745|
## |&nbsp;&nbsp;&nbsp;N-Miss                 |        651         |        587        |        224        |        |
## |&nbsp;&nbsp;&nbsp;Mean (SD)              |   7.663 (1.563)    |   7.648 (1.561)   |   7.650 (1.535)   |        |
## |&nbsp;&nbsp;&nbsp;Range                  |   1.722 - 15.902   |  1.722 - 15.902   |  1.722 - 15.902   |        |
## |**prnt.empl.bl**                         |                    |                   |                   |   0.098|
## |&nbsp;&nbsp;&nbsp;N-Miss                 |         56         |        47         |        22         |        |
## |&nbsp;&nbsp;&nbsp;Employed               |    8194 (69.5%)    |   7826 (70.2%)    |   5214 (71.3%)    |        |
## |&nbsp;&nbsp;&nbsp;Other                  |     855 (7.3%)     |    791 (7.1%)     |    474 (6.5%)     |        |
## |&nbsp;&nbsp;&nbsp;Stay at Home Parent    |    2065 (17.5%)    |   1941 (17.4%)    |   1262 (17.3%)    |        |
## |&nbsp;&nbsp;&nbsp;Unemployed             |     669 (5.7%)     |    595 (5.3%)     |    362 (5.0%)     |        |
## |**overall.income.bl**                    |                    |                   |                   |   0.001|
## |&nbsp;&nbsp;&nbsp;N-Miss                 |         2          |         1         |         0         |        |
## |&nbsp;&nbsp;&nbsp;[<50k]                 |    3215 (27.2%)    |   2930 (26.2%)    |   1833 (25.0%)    |        |
## |&nbsp;&nbsp;&nbsp;[>=100K]               |    4544 (38.4%)    |   4419 (39.5%)    |   2952 (40.3%)    |        |
## |&nbsp;&nbsp;&nbsp;[>=50K & <100K]        |    3065 (25.9%)    |   2937 (26.2%)    |   2000 (27.3%)    |        |
## |&nbsp;&nbsp;&nbsp;[Don't Know or Refuse] |    1013 (8.6%)     |    913 (8.2%)     |    549 (7.5%)     |        |
## |**sex.bl**                               |                    |                   |                   |   0.906|
## |&nbsp;&nbsp;&nbsp;Female                 |    5658 (47.8%)    |   5335 (47.6%)    |   3481 (47.5%)    |        |
## |&nbsp;&nbsp;&nbsp;Male                   |    6181 (52.2%)    |   5865 (52.4%)    |   3853 (52.5%)    |        |
## |**race_ethnicity.bl**                    |                    |                   |                   | < 0.001|
## |&nbsp;&nbsp;&nbsp;N-Miss                 |         2          |         2         |         0         |        |
## |&nbsp;&nbsp;&nbsp;Asian                  |     250 (2.1%)     |    239 (2.1%)     |    158 (2.2%)     |        |
## |&nbsp;&nbsp;&nbsp;Black                  |    1777 (15.0%)    |   1594 (14.2%)    |    874 (11.9%)    |        |
## |&nbsp;&nbsp;&nbsp;Hispanic               |    2405 (20.3%)    |   2220 (19.8%)    |   1411 (19.2%)    |        |
## |&nbsp;&nbsp;&nbsp;Other                  |    1243 (10.5%)    |   1171 (10.5%)    |    724 (9.9%)     |        |
## |&nbsp;&nbsp;&nbsp;White                  |    6162 (52.1%)    |   5974 (53.3%)    |   4167 (56.8%)    |        |
## |**high.educ.bl**                         |                    |                   |                   | < 0.001|
## |&nbsp;&nbsp;&nbsp;N-Miss                 |         14         |        12         |        10         |        |
## |&nbsp;&nbsp;&nbsp;< HS Diploma           |     592 (5.0%)     |    526 (4.7%)     |    306 (4.2%)     |        |
## |&nbsp;&nbsp;&nbsp;Bachelor               |    3006 (25.4%)    |   2889 (25.8%)    |   2002 (27.3%)    |        |
## |&nbsp;&nbsp;&nbsp;HS Diploma/GED         |    1129 (9.5%)     |    1007 (9.0%)    |    568 (7.8%)     |        |
## |&nbsp;&nbsp;&nbsp;Post Graduate Degree   |    4025 (34.0%)    |   3919 (35.0%)    |   2611 (35.6%)    |        |
## |&nbsp;&nbsp;&nbsp;Some College           |    3073 (26.0%)    |   2847 (25.4%)    |   1837 (25.1%)    |        |
## |**neighb_phenx_avg_p.bl**                |                    |                   |                   |   0.003|
## |&nbsp;&nbsp;&nbsp;N-Miss                 |         8          |         5         |         3         |        |
## |&nbsp;&nbsp;&nbsp;Mean (SD)              |   3.890 (0.975)    |   3.903 (0.969)   |   3.938 (0.942)   |        |
## |&nbsp;&nbsp;&nbsp;Range                  |   1.000 - 5.000    |   1.000 - 5.000   |   1.000 - 5.000   |        |
## |**cbcl_scr_syn_internal_r**              |                    |                   |                   |   0.100|
## |&nbsp;&nbsp;&nbsp;N-Miss                 |         8          |        18         |         5         |        |
## |&nbsp;&nbsp;&nbsp;Mean (SD)              |   5.043 (5.522)    |   5.108 (5.551)   |   4.930 (5.614)   |        |
## |&nbsp;&nbsp;&nbsp;Range                  |   0.000 - 51.000   |  0.000 - 48.000   |  0.000 - 50.000   |        |
## |**cbcl_scr_syn_external_r**              |                    |                   |                   | < 0.001|
## |&nbsp;&nbsp;&nbsp;N-Miss                 |         8          |        18         |         5         |        |
## |&nbsp;&nbsp;&nbsp;Mean (SD)              |   4.455 (5.867)    |   4.176 (5.656)   |   3.918 (5.479)   |        |
## |&nbsp;&nbsp;&nbsp;Range                  |   0.000 - 49.000   |  0.000 - 47.000   |  0.000 - 46.000   |        |
## |**cbcl_scr_syn_anxdep_r**                |                    |                   |                   | < 0.001|
## |&nbsp;&nbsp;&nbsp;N-Miss                 |         8          |        18         |         5         |        |
## |&nbsp;&nbsp;&nbsp;Mean (SD)              |   2.516 (3.062)    |   2.540 (3.072)   |   2.322 (2.971)   |        |
## |&nbsp;&nbsp;&nbsp;Range                  |   0.000 - 26.000   |  0.000 - 22.000   |  0.000 - 22.000   |        |
## |**cbcl_scr_syn_withdep_r**               |                    |                   |                   | < 0.001|
## |&nbsp;&nbsp;&nbsp;N-Miss                 |         8          |        18         |         5         |        |
## |&nbsp;&nbsp;&nbsp;Mean (SD)              |   1.034 (1.709)    |   1.116 (1.778)   |   1.201 (1.901)   |        |
## |&nbsp;&nbsp;&nbsp;Range                  |   0.000 - 15.000   |  0.000 - 14.000   |  0.000 - 16.000   |        |
## |**cbcl_scr_syn_attention_r**             |                    |                   |                   | < 0.001|
## |&nbsp;&nbsp;&nbsp;N-Miss                 |         8          |        18         |         5         |        |
## |&nbsp;&nbsp;&nbsp;Mean (SD)              |   2.977 (3.495)    |   2.858 (3.431)   |   2.692 (3.298)   |        |
## |&nbsp;&nbsp;&nbsp;Range                  |   0.000 - 20.000   |  0.000 - 19.000   |  0.000 - 19.000   |        |
## |**cbcl_scr_syn_rulebreak_r**             |                    |                   |                   | < 0.001|
## |&nbsp;&nbsp;&nbsp;N-Miss                 |         8          |        18         |         5         |        |
## |&nbsp;&nbsp;&nbsp;Mean (SD)              |   1.192 (1.861)    |   1.120 (1.822)   |   1.057 (1.833)   |        |
## |&nbsp;&nbsp;&nbsp;Range                  |   0.000 - 20.000   |  0.000 - 20.000   |  0.000 - 23.000   |        |
## |**cbcl_scr_syn_aggressive_r**            |                    |                   |                   | < 0.001|
## |&nbsp;&nbsp;&nbsp;N-Miss                 |         8          |        18         |         5         |        |
## |&nbsp;&nbsp;&nbsp;Mean (SD)              |   3.262 (4.355)    |   3.056 (4.185)   |   2.861 (3.990)   |        |
## |&nbsp;&nbsp;&nbsp;Range                  |   0.000 - 36.000   |  0.000 - 33.000   |  0.000 - 32.000   |        |
## |**cbcl_scr_syn_totprob_r**               |                    |                   |                   | < 0.001|
## |&nbsp;&nbsp;&nbsp;N-Miss                 |         8          |        18         |         5         |        |
## |&nbsp;&nbsp;&nbsp;Mean (SD)              |  18.178 (17.968)   |  17.520 (17.567)  |  16.388 (17.001)  |        |
## |&nbsp;&nbsp;&nbsp;Range                  |  0.000 - 139.000   |  0.000 - 128.000  |  0.000 - 161.000  |        |

Creating variables for modeling and tables

The following variables are time-invariant, will use baseline covariates since PM2.5 collected at baseline: - reshist_addr1_pm252016aa_bl which is the Baseline PM2.5. - reshist_addr1_no2_2016_aavg_bl which is the Baseline NO2. - sex.bl - race_ethnicity.bl - high.educ.bl - prnt.empl.bl - neighb_phenx_avg_p.bl - overall.income.bl

The following variables are time-varying: - all CBCL outcomes - interview_age

Copy baseline variables to all timepoints for 1KidPerFamily

#rename so can use later
names(HEI_Aim2_Long_1KidPerFamily)[names(HEI_Aim2_Long_1KidPerFamily) == 'prnt.empl.bl'] <- 'prnt.empl.b'

#create dataset for table and comparison
baseline_vars_1KidPerFamily <- subset(HEI_Aim2_Long_1KidPerFamily, HEI_Aim2_Long_1KidPerFamily$eventname=="Baseline", select = c("subjectid", "sex", "race_ethnicity", "high.educ", "neighb_phenx_avg_p", "overall.income.b"))

#rename variables
names(baseline_vars_1KidPerFamily)[names(baseline_vars_1KidPerFamily) == 'sex'] <- 'sex.bl'
names(baseline_vars_1KidPerFamily)[names(baseline_vars_1KidPerFamily) == 'race_ethnicity'] <- 'race_ethnicity.bl'
names(baseline_vars_1KidPerFamily)[names(baseline_vars_1KidPerFamily) == 'high.educ'] <- 'high.educ.bl'
names(baseline_vars_1KidPerFamily)[names(baseline_vars_1KidPerFamily) == 'neighb_phenx_avg_p'] <- 'neighb_phenx_avg_p.bl'
names(baseline_vars_1KidPerFamily)[names(baseline_vars_1KidPerFamily) == 'overall.income.b'] <- 'overall.income.bl'
names(baseline_vars_1KidPerFamily)[names(baseline_vars_1KidPerFamily) == 'prnt.empl.b'] <- 'prnt.empl.bl'

#add to initial df
HEI_Aim2_Long_1KidPerFamily_2 <- merge(HEI_Aim2_Long_1KidPerFamily, baseline_vars, by="subjectid")

Clean 1KidPerFamily

## Cleaning
#merge Asian into Other group b/c statistically Asian group is too small
tapply(HEI_Aim2_Long_1KidPerFamily_2$race_ethnicity.bl, 
       HEI_Aim2_Long_1KidPerFamily_2$eventname,table, useNA = "always")
## $`1-year`
## 
##    Asian    Black Hispanic    Other    White     <NA> 
##      217     1334     1932      964     4803        1 
## 
## $`2-year`
## 
##    Asian    Black Hispanic    Other    White     <NA> 
##      141      715     1232      597     3326        0 
## 
## $Baseline
## 
##    Asian    Black Hispanic    Other    White     <NA> 
##      228     1496     2101     1029     4963        1
HEI_Aim2_Long_1KidPerFamily_2$race_ethnicity.bl <- 
  ifelse(HEI_Aim2_Long_1KidPerFamily_2$race_ethnicity.bl=="Asian","Other",
         HEI_Aim2_Long_1KidPerFamily_2$race_ethnicity.bl)

tapply(HEI_Aim2_Long_1KidPerFamily_2$race_ethnicity.bl, 
       HEI_Aim2_Long_1KidPerFamily_2$eventname,table, useNA = "always")
## $`1-year`
## 
##    Black Hispanic    Other    White     <NA> 
##     1334     1932     1181     4803        1 
## 
## $`2-year`
## 
##    Black Hispanic    Other    White     <NA> 
##      715     1232      738     3326        0 
## 
## $Baseline
## 
##    Black Hispanic    Other    White     <NA> 
##     1496     2101     1257     4963        1
#reformat variables
HEI_Aim2_Long_1KidPerFamily_2$eventname <- 
  as.factor(HEI_Aim2_Long_1KidPerFamily_2$eventname)

HEI_Aim2_Long_1KidPerFamily_2$eventname <- 
  relevel(HEI_Aim2_Long_1KidPerFamily_2$eventname , ref="Baseline")

table(HEI_Aim2_Long_1KidPerFamily_2$eventname, useNA = "always")
## 
## Baseline   1-year   2-year     <NA> 
##     9818     9251     6011        0
HEI_Aim2_Long_1KidPerFamily_2$cbcl_scr_syn_internal_r <- as.numeric(HEI_Aim2_Long_1KidPerFamily_2$cbcl_scr_syn_internal_r)
HEI_Aim2_Long_1KidPerFamily_2$cbcl_scr_syn_external_r <- as.numeric(HEI_Aim2_Long_1KidPerFamily_2$cbcl_scr_syn_external_r)
HEI_Aim2_Long_1KidPerFamily_2$cbcl_scr_syn_anxdep_r <- as.numeric(HEI_Aim2_Long_1KidPerFamily_2$cbcl_scr_syn_anxdep_r)
HEI_Aim2_Long_1KidPerFamily_2$cbcl_scr_syn_withdep_r <- as.numeric(HEI_Aim2_Long_1KidPerFamily_2$cbcl_scr_syn_withdep_r)
HEI_Aim2_Long_1KidPerFamily_2$cbcl_scr_syn_attention_r <- as.numeric(HEI_Aim2_Long_1KidPerFamily_2$cbcl_scr_syn_attention_r)
HEI_Aim2_Long_1KidPerFamily_2$cbcl_scr_syn_rulebreak_r <- as.numeric(HEI_Aim2_Long_1KidPerFamily_2$cbcl_scr_syn_rulebreak_r)
HEI_Aim2_Long_1KidPerFamily_2$cbcl_scr_syn_aggressive_r <- as.numeric(HEI_Aim2_Long_1KidPerFamily_2$cbcl_scr_syn_aggressive_r)
HEI_Aim2_Long_1KidPerFamily_2$cbcl_scr_syn_totprob_r <- as.numeric(HEI_Aim2_Long_1KidPerFamily_2$cbcl_scr_syn_totprob_r)
HEI_Aim2_Long_1KidPerFamily_2$abcd_site <- as.factor(HEI_Aim2_Long_1KidPerFamily_2$abcd_site)
HEI_Aim2_Long_1KidPerFamily_2$subjectid <- as.factor(HEI_Aim2_Long_1KidPerFamily_2$subjectid)
HEI_Aim2_Long_1KidPerFamily_2$prnt.empl.bl <- factor(HEI_Aim2_Long_1KidPerFamily_2$prnt.empl.bl, levels = c("Employed", "Stay at Home Parent", "Unemployed", "Other"))
HEI_Aim2_Long_1KidPerFamily_2$overall.income.bl <- factor(HEI_Aim2_Long_1KidPerFamily_2$overall.income.bl, levels = c("[>=100K]", "[>=50K & <100K]", "[<50k]", "[Don't Know or Refuse]"))
HEI_Aim2_Long_1KidPerFamily_2$sex.bl <- factor(HEI_Aim2_Long_1KidPerFamily_2$sex.bl, levels = c("Male", "Female"))
HEI_Aim2_Long_1KidPerFamily_2$race_ethnicity.bl <- factor(HEI_Aim2_Long_1KidPerFamily_2$race_ethnicity.bl, levels = c("White", "Hispanic", "Black", "Other"))
HEI_Aim2_Long_1KidPerFamily_2$high.educ.bl <- factor(HEI_Aim2_Long_1KidPerFamily_2$high.educ.bl, levels = c("Post Graduate Degree", "Bachelor", "Some College", "HS Diploma/GED", "< HS Diploma"))

Create Final Dataset

#create smaller df
df <- subset(HEI_Aim2_Long_1KidPerFamily_2,select=c("subjectid","abcd_site","eventname","interview_age","reshist_addr1_pm252016aa_bl","reshist_addr1_no2_2016_aavg_bl","prnt.empl.bl","overall.income.bl","sex.bl","race_ethnicity.bl","high.educ.bl","neighb_phenx_avg_p.bl","cbcl_scr_syn_internal_r","cbcl_scr_syn_external_r","cbcl_scr_syn_anxdep_r","cbcl_scr_syn_withdep_r","cbcl_scr_syn_attention_r","cbcl_scr_syn_rulebreak_r","cbcl_scr_syn_aggressive_r","cbcl_scr_syn_totprob_r"))

#complete cases because needed for zinb
df_cc <- df[complete.cases(df),]

#center age at 9years-old (i.e., 108 months)
df_cc$interview_age.c9 <- df_cc$interview_age-108
#change to years
df_cc$interview_age.c9.y <- df_cc$interview_age.c9/12
#center pm2.5 to 5 (recommended by WHO)
df_cc$reshist_addr1_pm252016aa_bl.c5 <- df_cc$reshist_addr1_pm252016aa_bl-5
#center no2 to 5.33 (recommended by WHO)
df_cc$reshist_addr1_no2_2016_aavg_bl.c533 <- df_cc$reshist_addr1_no2_2016_aavg_bl-5.33

#center around mean
neighb_phenx_avg_p.bl.cm <- df_cc$neighb_phenx_avg_p.bl - mean(df_cc$neighb_phenx_avg_p.bl)

Internalizing

CBCL + AP Longitudinal Models

Zero-Inflated (ZI) Negative Binomial (NB): glmm.zinb in NBZIMM package.

CBCL only needs one nested random intercept since we eliminated the family nesting by choosing one kid per family.

For the negative binomial portion of the model, we do not nest by subject since the ICC across subjects is very low.

internal_zinb_r <- glmm.zinb(cbcl_scr_syn_internal_r ~ reshist_addr1_no2_2016_aavg_bl.c533*interview_age.c9.y + race_ethnicity.bl + high.educ.bl+ prnt.empl.bl  + neighb_phenx_avg_p.bl.cm + overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5, random = ~1|abcd_site/subjectid, 
              zi_fixed = ~ reshist_addr1_no2_2016_aavg_bl.c533*interview_age.c9.y + race_ethnicity.bl + high.educ.bl+ prnt.empl.bl  + neighb_phenx_avg_p.bl.cm + overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5, zi_random = ~1|abcd_site, data = df_cc)
## Computational iterations: 7 
## Computational time: 1.264 minutes
summary(internal_zinb_r)
## Linear mixed-effects model fit by maximum likelihood
##   Data: df_cc 
##   AIC BIC logLik
##    NA  NA     NA
## 
## Random effects:
##  Formula: ~1 | abcd_site
##         (Intercept)
## StdDev:   0.1085146
## 
##  Formula: ~1 | subjectid %in% abcd_site
##         (Intercept) Residual
## StdDev:   0.8510807 1.107308
## 
## Variance function:
##  Structure: fixed weights
##  Formula: ~invwt 
## Fixed effects:  cbcl_scr_syn_internal_r ~ reshist_addr1_no2_2016_aavg_bl.c533 *      interview_age.c9.y + race_ethnicity.bl + high.educ.bl + prnt.empl.bl +      neighb_phenx_avg_p.bl.cm + overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5 
##                                                             Value  Std.Error
## (Intercept)                                             1.2936895 0.05245352
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.0011251 0.00296731
## interview_age.c9.y                                      0.0404698 0.01122769
## race_ethnicity.blHispanic                              -0.0243655 0.03135028
## race_ethnicity.blBlack                                 -0.3595029 0.03531507
## race_ethnicity.blOther                                 -0.0510735 0.03170440
## high.educ.blBachelor                                    0.0189736 0.02650239
## high.educ.blSome College                                0.0485201 0.03037983
## high.educ.blHS Diploma/GED                             -0.1307243 0.04312578
## high.educ.bl< HS Diploma                               -0.1091826 0.05555388
## prnt.empl.blStay at Home Parent                         0.0310290 0.02694847
## prnt.empl.blUnemployed                                  0.1286331 0.04440603
## prnt.empl.blOther                                       0.1997791 0.03881988
## neighb_phenx_avg_p.bl.cm                               -0.1218295 0.01132058
## overall.income.bl[>=50K & <100K]                        0.1078712 0.02683220
## overall.income.bl[<50k]                                 0.1694380 0.03382049
## overall.income.bl[Don't Know or Refuse]                 0.0699945 0.04256480
## sex.blFemale                                            0.0498815 0.01969301
## reshist_addr1_pm252016aa_bl.c5                         -0.0081566 0.01002029
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.0028425 0.00077516
##                                                           DF    t-value p-value
## (Intercept)                                            14510  24.663539  0.0000
## reshist_addr1_no2_2016_aavg_bl.c533                     9307  -0.379177  0.7046
## interview_age.c9.y                                     14510   3.604461  0.0003
## race_ethnicity.blHispanic                               9307  -0.777203  0.4371
## race_ethnicity.blBlack                                  9307 -10.179871  0.0000
## race_ethnicity.blOther                                  9307  -1.610928  0.1072
## high.educ.blBachelor                                    9307   0.715920  0.4741
## high.educ.blSome College                                9307   1.597115  0.1103
## high.educ.blHS Diploma/GED                              9307  -3.031233  0.0024
## high.educ.bl< HS Diploma                                9307  -1.965345  0.0494
## prnt.empl.blStay at Home Parent                         9307   1.151419  0.2496
## prnt.empl.blUnemployed                                  9307   2.896748  0.0038
## prnt.empl.blOther                                       9307   5.146309  0.0000
## neighb_phenx_avg_p.bl.cm                                9307 -10.761771  0.0000
## overall.income.bl[>=50K & <100K]                        9307   4.020217  0.0001
## overall.income.bl[<50k]                                 9307   5.009923  0.0000
## overall.income.bl[Don't Know or Refuse]                 9307   1.644423  0.1001
## sex.blFemale                                            9307   2.532954  0.0113
## reshist_addr1_pm252016aa_bl.c5                          9307  -0.814005  0.4157
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y 14510  -3.666965  0.0002
##  Correlation: 
##                                                        (Intr) rs_1_2_2016__.533
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.606                  
## interview_age.c9.y                                     -0.374  0.428           
## race_ethnicity.blHispanic                              -0.025 -0.051           
## race_ethnicity.blBlack                                 -0.019 -0.075           
## race_ethnicity.blOther                                 -0.081 -0.027           
## high.educ.blBachelor                                   -0.178  0.010           
## high.educ.blSome College                               -0.122  0.018           
## high.educ.blHS Diploma/GED                             -0.072  0.004           
## high.educ.bl< HS Diploma                               -0.026 -0.019           
## prnt.empl.blStay at Home Parent                        -0.082  0.005           
## prnt.empl.blUnemployed                                 -0.025 -0.010           
## prnt.empl.blOther                                      -0.037 -0.002           
## neighb_phenx_avg_p.bl.cm                               -0.176  0.089           
## overall.income.bl[>=50K & <100K]                       -0.118 -0.012           
## overall.income.bl[<50k]                                -0.058 -0.019           
## overall.income.bl[Don't Know or Refuse]                -0.054 -0.009           
## sex.blFemale                                           -0.181  0.000           
## reshist_addr1_pm252016aa_bl.c5                         -0.305 -0.234           
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.342 -0.464           
##                                                        in_.9. rc_t.H rc_t.B
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                              -0.001              
## race_ethnicity.blBlack                                  0.001  0.349       
## race_ethnicity.blOther                                  0.000  0.286  0.256
## high.educ.blBachelor                                   -0.005 -0.019 -0.013
## high.educ.blSome College                                0.001 -0.111 -0.084
## high.educ.blHS Diploma/GED                              0.002 -0.143 -0.142
## high.educ.bl< HS Diploma                               -0.006 -0.166 -0.071
## prnt.empl.blStay at Home Parent                         0.003  0.044  0.091
## prnt.empl.blUnemployed                                 -0.002  0.010 -0.040
## prnt.empl.blOther                                       0.003  0.040  0.009
## neighb_phenx_avg_p.bl.cm                               -0.006  0.029  0.137
## overall.income.bl[>=50K & <100K]                       -0.006 -0.091 -0.059
## overall.income.bl[<50k]                                -0.005 -0.145 -0.181
## overall.income.bl[Don't Know or Refuse]                -0.010 -0.096 -0.124
## sex.blFemale                                            0.002 -0.007 -0.017
## reshist_addr1_pm252016aa_bl.c5                         -0.007 -0.080 -0.028
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.921  0.004  0.004
##                                                        rc_t.O hgh..B hg..SC
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                   -0.001              
## high.educ.blSome College                               -0.024  0.455       
## high.educ.blHS Diploma/GED                             -0.006  0.330  0.494
## high.educ.bl< HS Diploma                               -0.009  0.262  0.406
## prnt.empl.blStay at Home Parent                         0.018 -0.028 -0.014
## prnt.empl.blUnemployed                                  0.010 -0.009 -0.009
## prnt.empl.blOther                                      -0.012 -0.013 -0.033
## neighb_phenx_avg_p.bl.cm                                0.040 -0.004  0.061
## overall.income.bl[>=50K & <100K]                       -0.014 -0.174 -0.277
## overall.income.bl[<50k]                                -0.081 -0.159 -0.417
## overall.income.bl[Don't Know or Refuse]                -0.061 -0.100 -0.250
## sex.blFemale                                           -0.018  0.015  0.023
## reshist_addr1_pm252016aa_bl.c5                         -0.023 -0.001 -0.016
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.002  0.004  0.000
##                                                        h..HSD h..<HD p..aHP
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                0.372              
## prnt.empl.blStay at Home Parent                        -0.050 -0.094       
## prnt.empl.blUnemployed                                 -0.068 -0.097  0.147
## prnt.empl.blOther                                      -0.010 -0.019  0.158
## neighb_phenx_avg_p.bl.cm                                0.056  0.051  0.027
## overall.income.bl[>=50K & <100K]                       -0.171 -0.113 -0.031
## overall.income.bl[<50k]                                -0.364 -0.307 -0.054
## overall.income.bl[Don't Know or Refuse]                -0.237 -0.218 -0.077
## sex.blFemale                                            0.015 -0.004 -0.005
## reshist_addr1_pm252016aa_bl.c5                         -0.008 -0.016 -0.016
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.002  0.007  0.001
##                                                        prn..U prn..O n___..
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                       0.131              
## neighb_phenx_avg_p.bl.cm                                0.021  0.004       
## overall.income.bl[>=50K & <100K]                       -0.015 -0.050  0.081
## overall.income.bl[<50k]                                -0.100 -0.139  0.150
## overall.income.bl[Don't Know or Refuse]                -0.077 -0.098  0.083
## sex.blFemale                                            0.020  0.020  0.026
## reshist_addr1_pm252016aa_bl.c5                         -0.002  0.000  0.058
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.004 -0.002  0.004
##                                                        o..[&< o..[<5 o..KoR
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                                          
## neighb_phenx_avg_p.bl.cm                                                   
## overall.income.bl[>=50K & <100K]                                           
## overall.income.bl[<50k]                                 0.505              
## overall.income.bl[Don't Know or Refuse]                 0.359  0.482       
## sex.blFemale                                           -0.006 -0.007  0.008
## reshist_addr1_pm252016aa_bl.c5                         -0.018 -0.029 -0.028
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.007  0.006  0.010
##                                                        sx.blF r_1_25
## reshist_addr1_no2_2016_aavg_bl.c533                                 
## interview_age.c9.y                                                  
## race_ethnicity.blHispanic                                           
## race_ethnicity.blBlack                                              
## race_ethnicity.blOther                                              
## high.educ.blBachelor                                                
## high.educ.blSome College                                            
## high.educ.blHS Diploma/GED                                          
## high.educ.bl< HS Diploma                                            
## prnt.empl.blStay at Home Parent                                     
## prnt.empl.blUnemployed                                              
## prnt.empl.blOther                                                   
## neighb_phenx_avg_p.bl.cm                                            
## overall.income.bl[>=50K & <100K]                                    
## overall.income.bl[<50k]                                             
## overall.income.bl[Don't Know or Refuse]                             
## sex.blFemale                                                        
## reshist_addr1_pm252016aa_bl.c5                         -0.004       
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.000  0.007
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -3.0443736 -0.7881532 -0.1966888  0.4323385  4.2636811 
## 
## Number of Observations: 23857
## Number of Groups: 
##                abcd_site subjectid %in% abcd_site 
##                       21                     9345
summary(internal_zinb_r$zi.fit)
## Linear mixed-effects model fit by maximum likelihood
##   Data: data 
##   AIC BIC logLik
##    NA  NA     NA
## 
## Random effects:
##  Formula: ~1 | abcd_site
##         (Intercept)  Residual
## StdDev:   0.3843123 0.6077039
## 
## Variance function:
##  Structure: fixed weights
##  Formula: ~invwt 
## Fixed effects:  zp ~ reshist_addr1_no2_2016_aavg_bl.c533 * interview_age.c9.y +      race_ethnicity.bl + high.educ.bl + prnt.empl.bl + neighb_phenx_avg_p.bl.cm +      overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5 
##                                                            Value  Std.Error
## (Intercept)                                            -3.932038 0.17295206
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.030062 0.01032432
## interview_age.c9.y                                     -0.041964 0.05777560
## race_ethnicity.blHispanic                               0.082638 0.07725034
## race_ethnicity.blBlack                                  0.898765 0.07389087
## race_ethnicity.blOther                                  0.391823 0.07537015
## high.educ.blBachelor                                    0.122001 0.06650467
## high.educ.blSome College                                0.046538 0.07583991
## high.educ.blHS Diploma/GED                              0.595090 0.09099086
## high.educ.bl< HS Diploma                                0.819590 0.10610147
## prnt.empl.blStay at Home Parent                        -0.048504 0.06512104
## prnt.empl.blUnemployed                                 -0.115317 0.09319960
## prnt.empl.blOther                                       0.018690 0.08708963
## neighb_phenx_avg_p.bl.cm                                0.252045 0.02670859
## overall.income.bl[>=50K & <100K]                       -0.069053 0.06928728
## overall.income.bl[<50k]                                 0.007307 0.08034764
## overall.income.bl[Don't Know or Refuse]                 0.308209 0.08921581
## sex.blFemale                                           -0.076706 0.04597172
## reshist_addr1_pm252016aa_bl.c5                          0.084353 0.02432427
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.013474 0.00414233
##                                                           DF    t-value p-value
## (Intercept)                                            23817 -22.734846  0.0000
## reshist_addr1_no2_2016_aavg_bl.c533                    23817  -2.911796  0.0036
## interview_age.c9.y                                     23817  -0.726328  0.4676
## race_ethnicity.blHispanic                              23817   1.069738  0.2847
## race_ethnicity.blBlack                                 23817  12.163413  0.0000
## race_ethnicity.blOther                                 23817   5.198654  0.0000
## high.educ.blBachelor                                   23817   1.834474  0.0666
## high.educ.blSome College                               23817   0.613631  0.5395
## high.educ.blHS Diploma/GED                             23817   6.540110  0.0000
## high.educ.bl< HS Diploma                               23817   7.724591  0.0000
## prnt.empl.blStay at Home Parent                        23817  -0.744831  0.4564
## prnt.empl.blUnemployed                                 23817  -1.237309  0.2160
## prnt.empl.blOther                                      23817   0.214601  0.8301
## neighb_phenx_avg_p.bl.cm                               23817   9.436857  0.0000
## overall.income.bl[>=50K & <100K]                       23817  -0.996625  0.3190
## overall.income.bl[<50k]                                23817   0.090942  0.9275
## overall.income.bl[Don't Know or Refuse]                23817   3.454643  0.0006
## sex.blFemale                                           23817  -1.668558  0.0952
## reshist_addr1_pm252016aa_bl.c5                         23817   3.467839  0.0005
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y 23817   3.252706  0.0011
##  Correlation: 
##                                                        (Intr) rs_1_2_2016__.533
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.675                  
## interview_age.c9.y                                     -0.611  0.691           
## race_ethnicity.blHispanic                              -0.028 -0.045           
## race_ethnicity.blBlack                                 -0.040 -0.066           
## race_ethnicity.blOther                                 -0.091 -0.023           
## high.educ.blBachelor                                   -0.140 -0.005           
## high.educ.blSome College                               -0.093  0.001           
## high.educ.blHS Diploma/GED                             -0.073 -0.008           
## high.educ.bl< HS Diploma                               -0.019 -0.041           
## prnt.empl.blStay at Home Parent                        -0.061 -0.005           
## prnt.empl.blUnemployed                                 -0.017 -0.014           
## prnt.empl.blOther                                      -0.026 -0.004           
## neighb_phenx_avg_p.bl.cm                               -0.141  0.061           
## overall.income.bl[>=50K & <100K]                       -0.076 -0.024           
## overall.income.bl[<50k]                                -0.040 -0.028           
## overall.income.bl[Don't Know or Refuse]                -0.036 -0.022           
## sex.blFemale                                           -0.125  0.003           
## reshist_addr1_pm252016aa_bl.c5                         -0.237 -0.164           
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.564 -0.763           
##                                                        in_.9. rc_t.H rc_t.B
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                               0.001              
## race_ethnicity.blBlack                                  0.011  0.466       
## race_ethnicity.blOther                                  0.006  0.354  0.343
## high.educ.blBachelor                                   -0.011 -0.014 -0.006
## high.educ.blSome College                               -0.001 -0.114 -0.103
## high.educ.blHS Diploma/GED                              0.010 -0.159 -0.160
## high.educ.bl< HS Diploma                               -0.018 -0.186 -0.102
## prnt.empl.blStay at Home Parent                        -0.005  0.046  0.107
## prnt.empl.blUnemployed                                 -0.005  0.017 -0.020
## prnt.empl.blOther                                       0.007  0.057  0.012
## neighb_phenx_avg_p.bl.cm                               -0.002  0.017  0.130
## overall.income.bl[>=50K & <100K]                       -0.015 -0.106 -0.091
## overall.income.bl[<50k]                                -0.011 -0.150 -0.207
## overall.income.bl[Don't Know or Refuse]                -0.018 -0.118 -0.153
## sex.blFemale                                            0.006 -0.003 -0.025
## reshist_addr1_pm252016aa_bl.c5                         -0.010 -0.074 -0.028
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.919  0.004  0.001
##                                                        rc_t.O hgh..B hg..SC
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                    0.005              
## high.educ.blSome College                               -0.010  0.478       
## high.educ.blHS Diploma/GED                              0.001  0.409  0.588
## high.educ.bl< HS Diploma                               -0.002  0.358  0.525
## prnt.empl.blStay at Home Parent                         0.024 -0.023 -0.012
## prnt.empl.blUnemployed                                  0.013 -0.018 -0.005
## prnt.empl.blOther                                      -0.008 -0.017 -0.032
## neighb_phenx_avg_p.bl.cm                                0.032  0.003  0.049
## overall.income.bl[>=50K & <100K]                       -0.024 -0.166 -0.283
## overall.income.bl[<50k]                                -0.079 -0.159 -0.408
## overall.income.bl[Don't Know or Refuse]                -0.069 -0.118 -0.296
## sex.blFemale                                           -0.017  0.006  0.009
## reshist_addr1_pm252016aa_bl.c5                         -0.008  0.009 -0.010
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.004  0.009  0.005
##                                                        h..HSD h..<HD p..aHP
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                0.543              
## prnt.empl.blStay at Home Parent                        -0.057 -0.125       
## prnt.empl.blUnemployed                                 -0.082 -0.121  0.177
## prnt.empl.blOther                                      -0.021 -0.036  0.166
## neighb_phenx_avg_p.bl.cm                                0.050  0.055  0.034
## overall.income.bl[>=50K & <100K]                       -0.207 -0.155 -0.024
## overall.income.bl[<50k]                                -0.412 -0.386 -0.051
## overall.income.bl[Don't Know or Refuse]                -0.309 -0.285 -0.094
## sex.blFemale                                            0.010 -0.014  0.011
## reshist_addr1_pm252016aa_bl.c5                          0.008 -0.008 -0.010
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.001  0.025  0.014
##                                                        prn..U prn..O n___..
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                       0.149              
## neighb_phenx_avg_p.bl.cm                                0.020 -0.009       
## overall.income.bl[>=50K & <100K]                       -0.014 -0.048  0.061
## overall.income.bl[<50k]                                -0.080 -0.126  0.123
## overall.income.bl[Don't Know or Refuse]                -0.081 -0.109  0.071
## sex.blFemale                                            0.036  0.018  0.019
## reshist_addr1_pm252016aa_bl.c5                          0.004  0.001  0.049
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.009 -0.003  0.002
##                                                        o..[&< o..[<5 o..KoR
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                                          
## neighb_phenx_avg_p.bl.cm                                                   
## overall.income.bl[>=50K & <100K]                                           
## overall.income.bl[<50k]                                 0.536              
## overall.income.bl[Don't Know or Refuse]                 0.440  0.606       
## sex.blFemale                                           -0.005 -0.003 -0.005
## reshist_addr1_pm252016aa_bl.c5                         -0.016 -0.022 -0.037
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.015  0.011  0.023
##                                                        sx.blF r_1_25
## reshist_addr1_no2_2016_aavg_bl.c533                                 
## interview_age.c9.y                                                  
## race_ethnicity.blHispanic                                           
## race_ethnicity.blBlack                                              
## race_ethnicity.blOther                                              
## high.educ.blBachelor                                                
## high.educ.blSome College                                            
## high.educ.blHS Diploma/GED                                          
## high.educ.bl< HS Diploma                                            
## prnt.empl.blStay at Home Parent                                     
## prnt.empl.blUnemployed                                              
## prnt.empl.blOther                                                   
## neighb_phenx_avg_p.bl.cm                                            
## overall.income.bl[>=50K & <100K]                                    
## overall.income.bl[<50k]                                             
## overall.income.bl[Don't Know or Refuse]                             
## sex.blFemale                                                        
## reshist_addr1_pm252016aa_bl.c5                         -0.006       
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.000  0.008
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -0.8497488 -0.3085840 -0.2374125 -0.1761323 18.2906536 
## 
## Number of Observations: 23857
## Number of Groups: 21
anova(internal_zinb_r)
##                                                        numDF denDF   F-value
## (Intercept)                                                1 14510 2665.2972
## reshist_addr1_no2_2016_aavg_bl.c533                        1  9307    2.5326
## interview_age.c9.y                                         1 14510    0.2877
## race_ethnicity.bl                                          3  9307   18.9623
## high.educ.bl                                               4  9307   12.1011
## prnt.empl.bl                                               3  9307   15.3917
## neighb_phenx_avg_p.bl.cm                                   1  9307  136.6297
## overall.income.bl                                          3  9307    9.8988
## sex.bl                                                     1  9307    6.4078
## reshist_addr1_pm252016aa_bl.c5                             1  9307    0.6223
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y     1 14510   13.4466
##                                                        p-value
## (Intercept)                                             <.0001
## reshist_addr1_no2_2016_aavg_bl.c533                     0.1116
## interview_age.c9.y                                      0.5917
## race_ethnicity.bl                                       <.0001
## high.educ.bl                                            <.0001
## prnt.empl.bl                                            <.0001
## neighb_phenx_avg_p.bl.cm                                <.0001
## overall.income.bl                                       <.0001
## sex.bl                                                  0.0114
## reshist_addr1_pm252016aa_bl.c5                          0.4302
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.0002
VarCorr(internal_zinb_r)
##             Variance     StdDev   
## abcd_site = pdLogChol(1)          
## (Intercept) 0.01177542   0.1085146
## subjectid = pdLogChol(1)          
## (Intercept) 0.72433830   0.8510807
## Residual    1.22613008   1.1073076

Assumption checking for ZINB Models

  • Zero inflated negative binomial (zinb) regression already has overdispersion and excess zeros and this is accounted for in the zinb modeling chosen, “The data distribution combines the negative binomial distribution and the logit distribution”

  • Details on zinb can be found here: link

For Model Checking we will follow the following pdf: link This info is further detailed/published in books by Cameron and Trivedi (2013) and Hilbe (2014) and in Garay, Hashimoto, Ortega, and Lachos (2011).

They suggest using Pearson residuals.

#Check outlier/residuals with this df
internal_res <- df_cc
internal_res$level1_resid.raw <- residuals(internal_zinb_r)
internal_res$level1_resid.pearson <- residuals(internal_zinb_r, type="pearson")
#Add predicted values (Yhat)
internal_res$cbcl_scr_syn_internal_r_predicted <- predict(internal_zinb_r,internal_res,type="response")
#Incidence
internal_res$incidence <- estimate.probability(internal_res$cbcl_scr_syn_internal_r, method="empirical")

#Plotting histogram of residuals, but may be skewed since using ZINB, so make sure to check below plots
hist(internal_res$level1_resid.pearson)

Incidence vs. X’s Plots

“These plots show each of the independent variables plotted against the incidence as measured by Y (CBCL Outcome). They should be scanned for outliers and curvilinear patterns.”

#age
ggplot(internal_res,aes(incidence,interview_age)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

#pm2.5
ggplot(internal_res,aes(incidence,reshist_addr1_no2_2016_aavg_bl)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

Residuals vs Y (CBCL Outcome) Plot

“This plot shows the residuals versus the dependent variable. It can be used to spot outliers.”

plot(internal_res$level1_resid.pearson, internal_res$cbcl_scr_syn_internal_r)

Residuals vs Yhat Plot

“This plot shows the residuals versus the predicted value (Yhat) of the dependent variable. It can show outliers.”

plot(internal_res$level1_resid.pearson, internal_res$cbcl_scr_syn_internal_r_predicted)

Residuals vs Row Plot

“This plot shows the residuals versus the row numbers. It is used to quickly spot rows that have large residuals.”

plot(as.numeric(rownames(internal_res)),internal_res$level1_resid.pearson)

Residuals vs X’s Plots

“These plots show the residuals plotted against the independent variables. They are used to spot outliers. They are also used to find curvilinear patterns that are not represented in the regression model.”

#age
ggplot(internal_res,aes(level1_resid.pearson,interview_age)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

#pm2.5
ggplot(internal_res,aes(level1_resid.pearson,reshist_addr1_no2_2016_aavg_bl)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

For below models, view Internalizing above for notes.

Externalizing

CBCL + AP Longitudinal Models

external_zinb_r <- glmm.zinb(cbcl_scr_syn_external_r ~ reshist_addr1_no2_2016_aavg_bl.c533*interview_age.c9.y + race_ethnicity.bl + high.educ.bl+ prnt.empl.bl  + neighb_phenx_avg_p.bl.cm + overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5, random = ~1|abcd_site/subjectid, 
              zi_fixed = ~ reshist_addr1_no2_2016_aavg_bl.c533*interview_age.c9.y + race_ethnicity.bl + high.educ.bl+ prnt.empl.bl  + neighb_phenx_avg_p.bl.cm + overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5, zi_random = ~1|abcd_site, data = df_cc)
## Computational iterations: 9 
## Computational time: 1.468 minutes
summary(external_zinb_r)
## Linear mixed-effects model fit by maximum likelihood
##   Data: df_cc 
##   AIC BIC logLik
##    NA  NA     NA
## 
## Random effects:
##  Formula: ~1 | abcd_site
##         (Intercept)
## StdDev:   0.1293724
## 
##  Formula: ~1 | subjectid %in% abcd_site
##         (Intercept) Residual
## StdDev:    1.099444 1.058006
## 
## Variance function:
##  Structure: fixed weights
##  Formula: ~invwt 
## Fixed effects:  cbcl_scr_syn_external_r ~ reshist_addr1_no2_2016_aavg_bl.c533 *      interview_age.c9.y + race_ethnicity.bl + high.educ.bl + prnt.empl.bl +      neighb_phenx_avg_p.bl.cm + overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5 
##                                                             Value  Std.Error
## (Intercept)                                             0.9912141 0.06451899
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.0007144 0.00364134
## interview_age.c9.y                                     -0.0063140 0.01227895
## race_ethnicity.blHispanic                              -0.0551928 0.04004591
## race_ethnicity.blBlack                                 -0.1040765 0.04439928
## race_ethnicity.blOther                                 -0.0377392 0.04074621
## high.educ.blBachelor                                    0.1074229 0.03414770
## high.educ.blSome College                                0.1942691 0.03891034
## high.educ.blHS Diploma/GED                              0.0682056 0.05456822
## high.educ.bl< HS Diploma                                0.1018384 0.07028178
## prnt.empl.blStay at Home Parent                         0.0120721 0.03457345
## prnt.empl.blUnemployed                                  0.1993709 0.05599139
## prnt.empl.blOther                                       0.1976230 0.04940597
## neighb_phenx_avg_p.bl.cm                               -0.1292312 0.01441705
## overall.income.bl[>=50K & <100K]                        0.1273511 0.03451008
## overall.income.bl[<50k]                                 0.2644654 0.04315648
## overall.income.bl[Don't Know or Refuse]                 0.1656061 0.05412205
## sex.blFemale                                           -0.2976044 0.02524486
## reshist_addr1_pm252016aa_bl.c5                         -0.0169361 0.01264763
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.0024448 0.00085211
##                                                           DF    t-value p-value
## (Intercept)                                            14510  15.363138  0.0000
## reshist_addr1_no2_2016_aavg_bl.c533                     9307  -0.196187  0.8445
## interview_age.c9.y                                     14510  -0.514209  0.6071
## race_ethnicity.blHispanic                               9307  -1.378238  0.1682
## race_ethnicity.blBlack                                  9307  -2.344104  0.0191
## race_ethnicity.blOther                                  9307  -0.926202  0.3544
## high.educ.blBachelor                                    9307   3.145830  0.0017
## high.educ.blSome College                                9307   4.992738  0.0000
## high.educ.blHS Diploma/GED                              9307   1.249915  0.2114
## high.educ.bl< HS Diploma                                9307   1.449002  0.1474
## prnt.empl.blStay at Home Parent                         9307   0.349173  0.7270
## prnt.empl.blUnemployed                                  9307   3.560743  0.0004
## prnt.empl.blOther                                       9307   3.999982  0.0001
## neighb_phenx_avg_p.bl.cm                                9307  -8.963780  0.0000
## overall.income.bl[>=50K & <100K]                        9307   3.690257  0.0002
## overall.income.bl[<50k]                                 9307   6.128058  0.0000
## overall.income.bl[Don't Know or Refuse]                 9307   3.059865  0.0022
## sex.blFemale                                            9307 -11.788713  0.0000
## reshist_addr1_pm252016aa_bl.c5                          9307  -1.339070  0.1806
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y 14510  -2.869061  0.0041
##  Correlation: 
##                                                        (Intr) rs_1_2_2016__.533
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.599                  
## interview_age.c9.y                                     -0.326  0.377           
## race_ethnicity.blHispanic                              -0.023 -0.055           
## race_ethnicity.blBlack                                 -0.020 -0.077           
## race_ethnicity.blOther                                 -0.084 -0.029           
## high.educ.blBachelor                                   -0.189  0.012           
## high.educ.blSome College                               -0.130  0.019           
## high.educ.blHS Diploma/GED                             -0.078  0.006           
## high.educ.bl< HS Diploma                               -0.030 -0.017           
## prnt.empl.blStay at Home Parent                        -0.084  0.004           
## prnt.empl.blUnemployed                                 -0.025 -0.012           
## prnt.empl.blOther                                      -0.037 -0.002           
## neighb_phenx_avg_p.bl.cm                               -0.182  0.089           
## overall.income.bl[>=50K & <100K]                       -0.127 -0.011           
## overall.income.bl[<50k]                                -0.064 -0.017           
## overall.income.bl[Don't Know or Refuse]                -0.061 -0.006           
## sex.blFemale                                           -0.182  0.000           
## reshist_addr1_pm252016aa_bl.c5                         -0.316 -0.234           
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.299 -0.407           
##                                                        in_.9. rc_t.H rc_t.B
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                               0.000              
## race_ethnicity.blBlack                                  0.001  0.357       
## race_ethnicity.blOther                                  0.000  0.288  0.263
## high.educ.blBachelor                                   -0.004 -0.022 -0.016
## high.educ.blSome College                                0.000 -0.111 -0.085
## high.educ.blHS Diploma/GED                              0.002 -0.144 -0.147
## high.educ.bl< HS Diploma                               -0.005 -0.168 -0.077
## prnt.empl.blStay at Home Parent                         0.003  0.043  0.092
## prnt.empl.blUnemployed                                 -0.002  0.010 -0.040
## prnt.empl.blOther                                       0.002  0.041  0.011
## neighb_phenx_avg_p.bl.cm                               -0.004  0.030  0.136
## overall.income.bl[>=50K & <100K]                       -0.006 -0.088 -0.061
## overall.income.bl[<50k]                                -0.004 -0.143 -0.182
## overall.income.bl[Don't Know or Refuse]                -0.008 -0.096 -0.125
## sex.blFemale                                            0.002 -0.008 -0.019
## reshist_addr1_pm252016aa_bl.c5                         -0.005 -0.084 -0.033
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.923  0.003  0.003
##                                                        rc_t.O hgh..B hg..SC
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                   -0.002              
## high.educ.blSome College                               -0.025  0.461       
## high.educ.blHS Diploma/GED                             -0.009  0.339  0.503
## high.educ.bl< HS Diploma                               -0.012  0.268  0.413
## prnt.empl.blStay at Home Parent                         0.017 -0.030 -0.015
## prnt.empl.blUnemployed                                  0.010 -0.009 -0.010
## prnt.empl.blOther                                      -0.011 -0.014 -0.033
## neighb_phenx_avg_p.bl.cm                                0.042 -0.004  0.061
## overall.income.bl[>=50K & <100K]                       -0.011 -0.175 -0.276
## overall.income.bl[<50k]                                -0.079 -0.160 -0.417
## overall.income.bl[Don't Know or Refuse]                -0.056 -0.100 -0.253
## sex.blFemale                                           -0.017  0.013  0.022
## reshist_addr1_pm252016aa_bl.c5                         -0.027  0.001 -0.017
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.002  0.004  0.001
##                                                        h..HSD h..<HD p..aHP
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                0.381              
## prnt.empl.blStay at Home Parent                        -0.050 -0.095       
## prnt.empl.blUnemployed                                 -0.069 -0.098  0.149
## prnt.empl.blOther                                      -0.014 -0.020  0.159
## neighb_phenx_avg_p.bl.cm                                0.055  0.049  0.028
## overall.income.bl[>=50K & <100K]                       -0.173 -0.115 -0.029
## overall.income.bl[<50k]                                -0.367 -0.310 -0.052
## overall.income.bl[Don't Know or Refuse]                -0.241 -0.220 -0.075
## sex.blFemale                                            0.014 -0.005 -0.006
## reshist_addr1_pm252016aa_bl.c5                         -0.009 -0.016 -0.017
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.001  0.006  0.001
##                                                        prn..U prn..O n___..
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                       0.134              
## neighb_phenx_avg_p.bl.cm                                0.023  0.003       
## overall.income.bl[>=50K & <100K]                       -0.014 -0.049  0.080
## overall.income.bl[<50k]                                -0.101 -0.139  0.151
## overall.income.bl[Don't Know or Refuse]                -0.079 -0.099  0.083
## sex.blFemale                                            0.018  0.017  0.027
## reshist_addr1_pm252016aa_bl.c5                         -0.002 -0.001  0.061
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.003 -0.001  0.003
##                                                        o..[&< o..[<5 o..KoR
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                                          
## neighb_phenx_avg_p.bl.cm                                                   
## overall.income.bl[>=50K & <100K]                                           
## overall.income.bl[<50k]                                 0.509              
## overall.income.bl[Don't Know or Refuse]                 0.364  0.490       
## sex.blFemale                                           -0.006 -0.007  0.007
## reshist_addr1_pm252016aa_bl.c5                         -0.018 -0.030 -0.030
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.006  0.005  0.008
##                                                        sx.blF r_1_25
## reshist_addr1_no2_2016_aavg_bl.c533                                 
## interview_age.c9.y                                                  
## race_ethnicity.blHispanic                                           
## race_ethnicity.blBlack                                              
## race_ethnicity.blOther                                              
## high.educ.blBachelor                                                
## high.educ.blSome College                                            
## high.educ.blHS Diploma/GED                                          
## high.educ.bl< HS Diploma                                            
## prnt.empl.blStay at Home Parent                                     
## prnt.empl.blUnemployed                                              
## prnt.empl.blOther                                                   
## neighb_phenx_avg_p.bl.cm                                            
## overall.income.bl[>=50K & <100K]                                    
## overall.income.bl[<50k]                                             
## overall.income.bl[Don't Know or Refuse]                             
## sex.blFemale                                                        
## reshist_addr1_pm252016aa_bl.c5                         -0.004       
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.000  0.006
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -3.1937533 -0.7290294 -0.2613143  0.3852753  4.4121102 
## 
## Number of Observations: 23857
## Number of Groups: 
##                abcd_site subjectid %in% abcd_site 
##                       21                     9345
summary(external_zinb_r$zi.fit)
## Linear mixed-effects model fit by maximum likelihood
##   Data: data 
##   AIC BIC logLik
##    NA  NA     NA
## 
## Random effects:
##  Formula: ~1 | abcd_site
##         (Intercept)  Residual
## StdDev:   0.2717397 0.5423831
## 
## Variance function:
##  Structure: fixed weights
##  Formula: ~invwt 
## Fixed effects:  zp ~ reshist_addr1_no2_2016_aavg_bl.c533 * interview_age.c9.y +      race_ethnicity.bl + high.educ.bl + prnt.empl.bl + neighb_phenx_avg_p.bl.cm +      overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5 
##                                                            Value  Std.Error
## (Intercept)                                            -4.123617 0.14329048
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.011481 0.00878942
## interview_age.c9.y                                      0.198899 0.04830688
## race_ethnicity.blHispanic                               0.201784 0.06369557
## race_ethnicity.blBlack                                  0.595178 0.06586044
## race_ethnicity.blOther                                  0.369174 0.06104144
## high.educ.blBachelor                                    0.103266 0.05365260
## high.educ.blSome College                                0.143513 0.06235994
## high.educ.blHS Diploma/GED                              0.411105 0.08163599
## high.educ.bl< HS Diploma                                0.550172 0.09862945
## prnt.empl.blStay at Home Parent                         0.017284 0.05403504
## prnt.empl.blUnemployed                                  0.023649 0.08290096
## prnt.empl.blOther                                      -0.292708 0.08708412
## neighb_phenx_avg_p.bl.cm                                0.202779 0.02330439
## overall.income.bl[>=50K & <100K]                       -0.200990 0.05602420
## overall.income.bl[<50k]                                -0.171727 0.06789425
## overall.income.bl[Don't Know or Refuse]                 0.164018 0.07694578
## sex.blFemale                                            0.225122 0.03899144
## reshist_addr1_pm252016aa_bl.c5                          0.068361 0.02029657
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.001296 0.00342753
##                                                           DF    t-value p-value
## (Intercept)                                            23817 -28.778024  0.0000
## reshist_addr1_no2_2016_aavg_bl.c533                    23817  -1.306207  0.1915
## interview_age.c9.y                                     23817   4.117411  0.0000
## race_ethnicity.blHispanic                              23817   3.167943  0.0015
## race_ethnicity.blBlack                                 23817   9.036962  0.0000
## race_ethnicity.blOther                                 23817   6.047919  0.0000
## high.educ.blBachelor                                   23817   1.924719  0.0543
## high.educ.blSome College                               23817   2.301370  0.0214
## high.educ.blHS Diploma/GED                             23817   5.035831  0.0000
## high.educ.bl< HS Diploma                               23817   5.578173  0.0000
## prnt.empl.blStay at Home Parent                        23817   0.319862  0.7491
## prnt.empl.blUnemployed                                 23817   0.285274  0.7754
## prnt.empl.blOther                                      23817  -3.361211  0.0008
## neighb_phenx_avg_p.bl.cm                               23817   8.701331  0.0000
## overall.income.bl[>=50K & <100K]                       23817  -3.587558  0.0003
## overall.income.bl[<50k]                                23817  -2.529326  0.0114
## overall.income.bl[Don't Know or Refuse]                23817   2.131609  0.0330
## sex.blFemale                                           23817   5.773635  0.0000
## reshist_addr1_pm252016aa_bl.c5                         23817   3.368116  0.0008
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y 23817   0.378079  0.7054
##  Correlation: 
##                                                        (Intr) rs_1_2_2016__.533
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.714                  
## interview_age.c9.y                                     -0.668  0.719           
## race_ethnicity.blHispanic                              -0.032 -0.043           
## race_ethnicity.blBlack                                 -0.032 -0.063           
## race_ethnicity.blOther                                 -0.085 -0.022           
## high.educ.blBachelor                                   -0.136 -0.002           
## high.educ.blSome College                               -0.094  0.005           
## high.educ.blHS Diploma/GED                             -0.066 -0.004           
## high.educ.bl< HS Diploma                               -0.014 -0.034           
## prnt.empl.blStay at Home Parent                        -0.065 -0.001           
## prnt.empl.blUnemployed                                 -0.018 -0.014           
## prnt.empl.blOther                                      -0.024 -0.001           
## neighb_phenx_avg_p.bl.cm                               -0.149  0.066           
## overall.income.bl[>=50K & <100K]                       -0.069 -0.019           
## overall.income.bl[<50k]                                -0.030 -0.023           
## overall.income.bl[Don't Know or Refuse]                -0.028 -0.019           
## sex.blFemale                                           -0.151  0.006           
## reshist_addr1_pm252016aa_bl.c5                         -0.233 -0.166           
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.609 -0.786           
##                                                        in_.9. rc_t.H rc_t.B
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                               0.002              
## race_ethnicity.blBlack                                  0.011  0.407       
## race_ethnicity.blOther                                  0.006  0.334  0.305
## high.educ.blBachelor                                   -0.013 -0.008 -0.005
## high.educ.blSome College                               -0.004 -0.116 -0.092
## high.educ.blHS Diploma/GED                              0.007 -0.154 -0.151
## high.educ.bl< HS Diploma                               -0.020 -0.172 -0.087
## prnt.empl.blStay at Home Parent                        -0.001  0.046  0.104
## prnt.empl.blUnemployed                                 -0.004  0.014 -0.031
## prnt.empl.blOther                                       0.007  0.041  0.002
## neighb_phenx_avg_p.bl.cm                               -0.004  0.022  0.128
## overall.income.bl[>=50K & <100K]                       -0.013 -0.097 -0.080
## overall.income.bl[<50k]                                -0.011 -0.140 -0.199
## overall.income.bl[Don't Know or Refuse]                -0.018 -0.106 -0.140
## sex.blFemale                                            0.008 -0.003 -0.018
## reshist_addr1_pm252016aa_bl.c5                         -0.013 -0.068 -0.027
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.917  0.004  0.002
##                                                        rc_t.O hgh..B hg..SC
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                    0.012              
## high.educ.blSome College                               -0.009  0.459       
## high.educ.blHS Diploma/GED                              0.002  0.361  0.538
## high.educ.bl< HS Diploma                                0.001  0.305  0.469
## prnt.empl.blStay at Home Parent                         0.021 -0.031 -0.019
## prnt.empl.blUnemployed                                  0.013 -0.016 -0.009
## prnt.empl.blOther                                      -0.013 -0.018 -0.027
## neighb_phenx_avg_p.bl.cm                                0.031  0.001  0.054
## overall.income.bl[>=50K & <100K]                       -0.020 -0.158 -0.285
## overall.income.bl[<50k]                                -0.079 -0.150 -0.413
## overall.income.bl[Don't Know or Refuse]                -0.064 -0.108 -0.284
## sex.blFemale                                           -0.012  0.012  0.017
## reshist_addr1_pm252016aa_bl.c5                         -0.013  0.005 -0.012
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.003  0.012  0.008
##                                                        h..HSD h..<HD p..aHP
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                0.465              
## prnt.empl.blStay at Home Parent                        -0.058 -0.116       
## prnt.empl.blUnemployed                                 -0.078 -0.116  0.164
## prnt.empl.blOther                                      -0.011 -0.027  0.140
## neighb_phenx_avg_p.bl.cm                                0.051  0.055  0.030
## overall.income.bl[>=50K & <100K]                       -0.189 -0.135 -0.022
## overall.income.bl[<50k]                                -0.396 -0.355 -0.048
## overall.income.bl[Don't Know or Refuse]                -0.288 -0.269 -0.091
## sex.blFemale                                            0.012 -0.005  0.004
## reshist_addr1_pm252016aa_bl.c5                          0.003 -0.021 -0.009
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.003  0.026  0.010
##                                                        prn..U prn..O n___..
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                       0.124              
## neighb_phenx_avg_p.bl.cm                                0.026 -0.005       
## overall.income.bl[>=50K & <100K]                       -0.012 -0.041  0.073
## overall.income.bl[<50k]                                -0.088 -0.117  0.133
## overall.income.bl[Don't Know or Refuse]                -0.083 -0.098  0.085
## sex.blFemale                                            0.031  0.013  0.023
## reshist_addr1_pm252016aa_bl.c5                          0.003  0.002  0.053
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.008 -0.004  0.003
##                                                        o..[&< o..[<5 o..KoR
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                                          
## neighb_phenx_avg_p.bl.cm                                                   
## overall.income.bl[>=50K & <100K]                                           
## overall.income.bl[<50k]                                 0.491              
## overall.income.bl[Don't Know or Refuse]                 0.389  0.547       
## sex.blFemale                                           -0.006 -0.005  0.000
## reshist_addr1_pm252016aa_bl.c5                         -0.011 -0.024 -0.036
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.014  0.012  0.024
##                                                        sx.blF r_1_25
## reshist_addr1_no2_2016_aavg_bl.c533                                 
## interview_age.c9.y                                                  
## race_ethnicity.blHispanic                                           
## race_ethnicity.blBlack                                              
## race_ethnicity.blOther                                              
## high.educ.blBachelor                                                
## high.educ.blSome College                                            
## high.educ.blHS Diploma/GED                                          
## high.educ.bl< HS Diploma                                            
## prnt.empl.blStay at Home Parent                                     
## prnt.empl.blUnemployed                                              
## prnt.empl.blOther                                                   
## neighb_phenx_avg_p.bl.cm                                            
## overall.income.bl[>=50K & <100K]                                    
## overall.income.bl[<50k]                                             
## overall.income.bl[Don't Know or Refuse]                             
## sex.blFemale                                                        
## reshist_addr1_pm252016aa_bl.c5                         -0.006       
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.002  0.013
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -0.8341328 -0.3553729 -0.2842283  0.2311904 17.3410959 
## 
## Number of Observations: 23857
## Number of Groups: 21
anova(external_zinb_r)
##                                                        numDF denDF  F-value
## (Intercept)                                                1 14510 918.9759
## reshist_addr1_no2_2016_aavg_bl.c533                        1  9307   0.3555
## interview_age.c9.y                                         1 14510  69.7852
## race_ethnicity.bl                                          3  9307   6.0429
## high.educ.bl                                               4  9307  31.7884
## prnt.empl.bl                                               3  9307  15.2829
## neighb_phenx_avg_p.bl.cm                                   1  9307  92.4746
## overall.income.bl                                          3  9307  12.2328
## sex.bl                                                     1  9307 139.0900
## reshist_addr1_pm252016aa_bl.c5                             1  9307   1.7495
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y     1 14510   8.2315
##                                                        p-value
## (Intercept)                                             <.0001
## reshist_addr1_no2_2016_aavg_bl.c533                     0.5510
## interview_age.c9.y                                      <.0001
## race_ethnicity.bl                                       0.0004
## high.educ.bl                                            <.0001
## prnt.empl.bl                                            <.0001
## neighb_phenx_avg_p.bl.cm                                <.0001
## overall.income.bl                                       <.0001
## sex.bl                                                  <.0001
## reshist_addr1_pm252016aa_bl.c5                          0.1860
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.0041
VarCorr(external_zinb_r)
##             Variance     StdDev   
## abcd_site = pdLogChol(1)          
## (Intercept) 0.01673721   0.1293724
## subjectid = pdLogChol(1)          
## (Intercept) 1.20877686   1.0994439
## Residual    1.11937607   1.0580057

Assumption checking for ZINB Models

#Check outlier/residuals with this df
external_res <- df_cc
external_res$level1_resid.raw <- residuals(external_zinb_r)
external_res$level1_resid.pearson <- residuals(external_zinb_r, type="pearson")
#Add predicted values (Yhat)
external_res$cbcl_scr_syn_external_r_predicted <- predict(external_zinb_r,external_res,type="response")
#Incidence
external_res$incidence <- estimate.probability(external_res$cbcl_scr_syn_external_r, method="empirical")

#Plotting histogram of residuals, but may be skewed since using ZINB, so make sure to check below plots
hist(external_res$level1_resid.pearson)

### Incidence vs. X’s Plots

#age
ggplot(external_res,aes(incidence,interview_age)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

#pm2.5
ggplot(external_res,aes(incidence,reshist_addr1_no2_2016_aavg_bl)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

### Residuals vs Y (CBCL Outcome) Plot

plot(external_res$level1_resid.pearson, external_res$cbcl_scr_syn_external_r)

### Residuals vs Yhat Plot

plot(external_res$level1_resid.pearson, external_res$cbcl_scr_syn_external_r_predicted)

### Residuals vs Row Plot

plot(as.numeric(rownames(external_res)),external_res$level1_resid.pearson)

### Residuals vs X’s Plots

#age
ggplot(external_res,aes(level1_resid.pearson,interview_age)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

#pm2.5
ggplot(external_res,aes(level1_resid.pearson,reshist_addr1_no2_2016_aavg_bl)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

Anxious/Depressed

CBCL + AP Longitudinal Models

anxdep_zinb_r <- glmm.zinb(cbcl_scr_syn_anxdep_r ~ reshist_addr1_no2_2016_aavg_bl.c533*interview_age.c9.y + race_ethnicity.bl + high.educ.bl+ prnt.empl.bl  + neighb_phenx_avg_p.bl.cm + overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5, random = ~1|abcd_site/subjectid, 
              zi_fixed = ~ reshist_addr1_no2_2016_aavg_bl.c533*interview_age.c9.y + race_ethnicity.bl + high.educ.bl+ prnt.empl.bl  + neighb_phenx_avg_p.bl.cm + overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5, zi_random = ~1|abcd_site, data = df_cc)
## Computational iterations: 11 
## Computational time: 1.836 minutes
summary(anxdep_zinb_r)
## Linear mixed-effects model fit by maximum likelihood
##   Data: df_cc 
##   AIC BIC logLik
##    NA  NA     NA
## 
## Random effects:
##  Formula: ~1 | abcd_site
##         (Intercept)
## StdDev:   0.1233201
## 
##  Formula: ~1 | subjectid %in% abcd_site
##         (Intercept)  Residual
## StdDev:   0.9717984 0.9387408
## 
## Variance function:
##  Structure: fixed weights
##  Formula: ~invwt 
## Fixed effects:  cbcl_scr_syn_anxdep_r ~ reshist_addr1_no2_2016_aavg_bl.c533 *      interview_age.c9.y + race_ethnicity.bl + high.educ.bl + prnt.empl.bl +      neighb_phenx_avg_p.bl.cm + overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5 
##                                                             Value  Std.Error
## (Intercept)                                             0.6766333 0.06021954
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.0031452 0.00341298
## interview_age.c9.y                                      0.0007070 0.01288197
## race_ethnicity.blHispanic                              -0.0126983 0.03628298
## race_ethnicity.blBlack                                 -0.4363446 0.04130931
## race_ethnicity.blOther                                 -0.0967148 0.03679433
## high.educ.blBachelor                                   -0.0290179 0.03065092
## high.educ.blSome College                               -0.0541162 0.03524018
## high.educ.blHS Diploma/GED                             -0.2833290 0.05035547
## high.educ.bl< HS Diploma                               -0.2712099 0.06496668
## prnt.empl.blStay at Home Parent                         0.0402540 0.03125643
## prnt.empl.blUnemployed                                  0.1839800 0.05152906
## prnt.empl.blOther                                       0.1508501 0.04525466
## neighb_phenx_avg_p.bl.cm                               -0.1135505 0.01316127
## overall.income.bl[>=50K & <100K]                        0.1119089 0.03104746
## overall.income.bl[<50k]                                 0.1606427 0.03927408
## overall.income.bl[Don't Know or Refuse]                 0.0335538 0.04956568
## sex.blFemale                                            0.0554366 0.02285218
## reshist_addr1_pm252016aa_bl.c5                         -0.0186305 0.01158560
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.0018656 0.00088718
##                                                           DF    t-value p-value
## (Intercept)                                            14510  11.236109  0.0000
## reshist_addr1_no2_2016_aavg_bl.c533                     9307  -0.921531  0.3568
## interview_age.c9.y                                     14510   0.054881  0.9562
## race_ethnicity.blHispanic                               9307  -0.349978  0.7264
## race_ethnicity.blBlack                                  9307 -10.562862  0.0000
## race_ethnicity.blOther                                  9307  -2.628525  0.0086
## high.educ.blBachelor                                    9307  -0.946722  0.3438
## high.educ.blSome College                                9307  -1.535639  0.1247
## high.educ.blHS Diploma/GED                              9307  -5.626580  0.0000
## high.educ.bl< HS Diploma                                9307  -4.174600  0.0000
## prnt.empl.blStay at Home Parent                         9307   1.287863  0.1978
## prnt.empl.blUnemployed                                  9307   3.570412  0.0004
## prnt.empl.blOther                                       9307   3.333361  0.0009
## neighb_phenx_avg_p.bl.cm                                9307  -8.627626  0.0000
## overall.income.bl[>=50K & <100K]                        9307   3.604445  0.0003
## overall.income.bl[<50k]                                 9307   4.090299  0.0000
## overall.income.bl[Don't Know or Refuse]                 9307   0.676956  0.4985
## sex.blFemale                                            9307   2.425876  0.0153
## reshist_addr1_pm252016aa_bl.c5                          9307  -1.608077  0.1079
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y 14510  -2.102867  0.0355
##  Correlation: 
##                                                        (Intr) rs_1_2_2016__.533
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.605                  
## interview_age.c9.y                                     -0.370  0.421           
## race_ethnicity.blHispanic                              -0.025 -0.050           
## race_ethnicity.blBlack                                 -0.021 -0.074           
## race_ethnicity.blOther                                 -0.081 -0.027           
## high.educ.blBachelor                                   -0.178  0.010           
## high.educ.blSome College                               -0.121  0.018           
## high.educ.blHS Diploma/GED                             -0.071  0.005           
## high.educ.bl< HS Diploma                               -0.025 -0.019           
## prnt.empl.blStay at Home Parent                        -0.082  0.005           
## prnt.empl.blUnemployed                                 -0.025 -0.011           
## prnt.empl.blOther                                      -0.037 -0.002           
## neighb_phenx_avg_p.bl.cm                               -0.178  0.089           
## overall.income.bl[>=50K & <100K]                       -0.120 -0.011           
## overall.income.bl[<50k]                                -0.059 -0.018           
## overall.income.bl[Don't Know or Refuse]                -0.055 -0.008           
## sex.blFemale                                           -0.184  0.000           
## reshist_addr1_pm252016aa_bl.c5                         -0.306 -0.236           
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.338 -0.457           
##                                                        in_.9. rc_t.H rc_t.B
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                              -0.001              
## race_ethnicity.blBlack                                  0.001  0.344       
## race_ethnicity.blOther                                 -0.001  0.285  0.253
## high.educ.blBachelor                                   -0.005 -0.018 -0.012
## high.educ.blSome College                                0.001 -0.109 -0.082
## high.educ.blHS Diploma/GED                              0.002 -0.141 -0.140
## high.educ.bl< HS Diploma                               -0.006 -0.165 -0.068
## prnt.empl.blStay at Home Parent                         0.003  0.043  0.092
## prnt.empl.blUnemployed                                 -0.002  0.010 -0.040
## prnt.empl.blOther                                       0.003  0.040  0.010
## neighb_phenx_avg_p.bl.cm                               -0.005  0.029  0.139
## overall.income.bl[>=50K & <100K]                       -0.006 -0.092 -0.059
## overall.income.bl[<50k]                                -0.005 -0.146 -0.179
## overall.income.bl[Don't Know or Refuse]                -0.010 -0.096 -0.120
## sex.blFemale                                            0.001 -0.008 -0.018
## reshist_addr1_pm252016aa_bl.c5                         -0.006 -0.081 -0.028
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.919  0.004  0.004
##                                                        rc_t.O hgh..B hg..SC
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                    0.000              
## high.educ.blSome College                               -0.024  0.453       
## high.educ.blHS Diploma/GED                             -0.006  0.327  0.488
## high.educ.bl< HS Diploma                               -0.009  0.258  0.401
## prnt.empl.blStay at Home Parent                         0.020 -0.031 -0.015
## prnt.empl.blUnemployed                                  0.010 -0.009 -0.009
## prnt.empl.blOther                                      -0.011 -0.013 -0.033
## neighb_phenx_avg_p.bl.cm                                0.039 -0.005  0.062
## overall.income.bl[>=50K & <100K]                       -0.015 -0.175 -0.277
## overall.income.bl[<50k]                                -0.081 -0.160 -0.418
## overall.income.bl[Don't Know or Refuse]                -0.061 -0.100 -0.249
## sex.blFemale                                           -0.018  0.015  0.023
## reshist_addr1_pm252016aa_bl.c5                         -0.024 -0.001 -0.017
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.002  0.004  0.001
##                                                        h..HSD h..<HD p..aHP
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                0.367              
## prnt.empl.blStay at Home Parent                        -0.053 -0.094       
## prnt.empl.blUnemployed                                 -0.069 -0.097  0.147
## prnt.empl.blOther                                      -0.011 -0.020  0.157
## neighb_phenx_avg_p.bl.cm                                0.057  0.051  0.027
## overall.income.bl[>=50K & <100K]                       -0.169 -0.111 -0.031
## overall.income.bl[<50k]                                -0.362 -0.306 -0.052
## overall.income.bl[Don't Know or Refuse]                -0.233 -0.215 -0.076
## sex.blFemale                                            0.015 -0.003 -0.006
## reshist_addr1_pm252016aa_bl.c5                         -0.010 -0.016 -0.016
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.001  0.007  0.002
##                                                        prn..U prn..O n___..
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                       0.131              
## neighb_phenx_avg_p.bl.cm                                0.022  0.004       
## overall.income.bl[>=50K & <100K]                       -0.014 -0.049  0.082
## overall.income.bl[<50k]                                -0.102 -0.140  0.149
## overall.income.bl[Don't Know or Refuse]                -0.077 -0.097  0.083
## sex.blFemale                                            0.020  0.020  0.027
## reshist_addr1_pm252016aa_bl.c5                         -0.002  0.000  0.060
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.003 -0.001  0.004
##                                                        o..[&< o..[<5 o..KoR
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                                          
## neighb_phenx_avg_p.bl.cm                                                   
## overall.income.bl[>=50K & <100K]                                           
## overall.income.bl[<50k]                                 0.503              
## overall.income.bl[Don't Know or Refuse]                 0.355  0.477       
## sex.blFemale                                           -0.006 -0.007  0.008
## reshist_addr1_pm252016aa_bl.c5                         -0.017 -0.028 -0.029
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.007  0.005  0.010
##                                                        sx.blF r_1_25
## reshist_addr1_no2_2016_aavg_bl.c533                                 
## interview_age.c9.y                                                  
## race_ethnicity.blHispanic                                           
## race_ethnicity.blBlack                                              
## race_ethnicity.blOther                                              
## high.educ.blBachelor                                                
## high.educ.blSome College                                            
## high.educ.blHS Diploma/GED                                          
## high.educ.bl< HS Diploma                                            
## prnt.empl.blStay at Home Parent                                     
## prnt.empl.blUnemployed                                              
## prnt.empl.blOther                                                   
## neighb_phenx_avg_p.bl.cm                                            
## overall.income.bl[>=50K & <100K]                                    
## overall.income.bl[<50k]                                             
## overall.income.bl[Don't Know or Refuse]                             
## sex.blFemale                                                        
## reshist_addr1_pm252016aa_bl.c5                         -0.003       
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.001  0.007
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -2.8213955 -0.7603808 -0.2213842  0.4352139  4.4170092 
## 
## Number of Observations: 23857
## Number of Groups: 
##                abcd_site subjectid %in% abcd_site 
##                       21                     9345
summary(anxdep_zinb_r$zi.fit)
## Linear mixed-effects model fit by maximum likelihood
##   Data: data 
##   AIC BIC logLik
##    NA  NA     NA
## 
## Random effects:
##  Formula: ~1 | abcd_site
##         (Intercept) Residual
## StdDev:   0.4140828 0.431547
## 
## Variance function:
##  Structure: fixed weights
##  Formula: ~invwt 
## Fixed effects:  zp ~ reshist_addr1_no2_2016_aavg_bl.c533 * interview_age.c9.y +      race_ethnicity.bl + high.educ.bl + prnt.empl.bl + neighb_phenx_avg_p.bl.cm +      overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5 
##                                                            Value  Std.Error
## (Intercept)                                            -4.947661 0.16498494
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.026339 0.00942274
## interview_age.c9.y                                      0.073993 0.05011007
## race_ethnicity.blHispanic                               0.014039 0.06457621
## race_ethnicity.blBlack                                  1.043904 0.05903589
## race_ethnicity.blOther                                  0.326024 0.06447837
## high.educ.blBachelor                                    0.342486 0.05637653
## high.educ.blSome College                                0.301923 0.06278417
## high.educ.blHS Diploma/GED                              0.542071 0.07652303
## high.educ.bl< HS Diploma                                0.918285 0.08541701
## prnt.empl.blStay at Home Parent                         0.017966 0.05319993
## prnt.empl.blUnemployed                                 -0.088141 0.07221644
## prnt.empl.blOther                                       0.055045 0.06771928
## neighb_phenx_avg_p.bl.cm                                0.308232 0.02156950
## overall.income.bl[>=50K & <100K]                       -0.185439 0.06003576
## overall.income.bl[<50k]                                 0.264104 0.06457005
## overall.income.bl[Don't Know or Refuse]                 0.321022 0.07441465
## sex.blFemale                                           -0.312032 0.03803103
## reshist_addr1_pm252016aa_bl.c5                          0.116731 0.02029249
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.021647 0.00353137
##                                                           DF    t-value p-value
## (Intercept)                                            23817 -29.988562  0.0000
## reshist_addr1_no2_2016_aavg_bl.c533                    23817  -2.795220  0.0052
## interview_age.c9.y                                     23817   1.476611  0.1398
## race_ethnicity.blHispanic                              23817   0.217402  0.8279
## race_ethnicity.blBlack                                 23817  17.682528  0.0000
## race_ethnicity.blOther                                 23817   5.056324  0.0000
## high.educ.blBachelor                                   23817   6.074983  0.0000
## high.educ.blSome College                               23817   4.808905  0.0000
## high.educ.blHS Diploma/GED                             23817   7.083759  0.0000
## high.educ.bl< HS Diploma                               23817  10.750605  0.0000
## prnt.empl.blStay at Home Parent                        23817   0.337701  0.7356
## prnt.empl.blUnemployed                                 23817  -1.220505  0.2223
## prnt.empl.blOther                                      23817   0.812845  0.4163
## neighb_phenx_avg_p.bl.cm                               23817  14.290180  0.0000
## overall.income.bl[>=50K & <100K]                       23817  -3.088805  0.0020
## overall.income.bl[<50k]                                23817   4.090190  0.0000
## overall.income.bl[Don't Know or Refuse]                23817   4.313968  0.0000
## sex.blFemale                                           23817  -8.204671  0.0000
## reshist_addr1_pm252016aa_bl.c5                         23817   5.752443  0.0000
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y 23817   6.129937  0.0000
##  Correlation: 
##                                                        (Intr) rs_1_2_2016__.533
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.663                  
## interview_age.c9.y                                     -0.609  0.714           
## race_ethnicity.blHispanic                              -0.027 -0.046           
## race_ethnicity.blBlack                                 -0.036 -0.075           
## race_ethnicity.blOther                                 -0.081 -0.025           
## high.educ.blBachelor                                   -0.143 -0.007           
## high.educ.blSome College                               -0.099 -0.003           
## high.educ.blHS Diploma/GED                             -0.081 -0.007           
## high.educ.bl< HS Diploma                               -0.032 -0.044           
## prnt.empl.blStay at Home Parent                        -0.057 -0.010           
## prnt.empl.blUnemployed                                 -0.018 -0.010           
## prnt.empl.blOther                                      -0.025 -0.001           
## neighb_phenx_avg_p.bl.cm                               -0.122  0.049           
## overall.income.bl[>=50K & <100K]                       -0.066 -0.025           
## overall.income.bl[<50k]                                -0.039 -0.031           
## overall.income.bl[Don't Know or Refuse]                -0.035 -0.024           
## sex.blFemale                                           -0.096  0.003           
## reshist_addr1_pm252016aa_bl.c5                         -0.207 -0.159           
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.567 -0.784           
##                                                        in_.9. rc_t.H rc_t.B
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                              -0.001              
## race_ethnicity.blBlack                                  0.010  0.496       
## race_ethnicity.blOther                                  0.007  0.361  0.369
## high.educ.blBachelor                                   -0.013 -0.018 -0.002
## high.educ.blSome College                               -0.001 -0.107 -0.096
## high.educ.blHS Diploma/GED                              0.009 -0.144 -0.146
## high.educ.bl< HS Diploma                               -0.019 -0.175 -0.102
## prnt.empl.blStay at Home Parent                        -0.006  0.051  0.109
## prnt.empl.blUnemployed                                 -0.003  0.013 -0.012
## prnt.empl.blOther                                       0.009  0.060  0.013
## neighb_phenx_avg_p.bl.cm                                0.001  0.015  0.139
## overall.income.bl[>=50K & <100K]                       -0.013 -0.104 -0.098
## overall.income.bl[<50k]                                -0.011 -0.160 -0.213
## overall.income.bl[Don't Know or Refuse]                -0.016 -0.119 -0.151
## sex.blFemale                                            0.005 -0.004 -0.034
## reshist_addr1_pm252016aa_bl.c5                         -0.003 -0.062 -0.018
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.928  0.005  0.007
##                                                        rc_t.O hgh..B hg..SC
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                    0.004              
## high.educ.blSome College                               -0.013  0.540       
## high.educ.blHS Diploma/GED                             -0.001  0.452  0.625
## high.educ.bl< HS Diploma                               -0.011  0.410  0.575
## prnt.empl.blStay at Home Parent                         0.032 -0.017 -0.009
## prnt.empl.blUnemployed                                  0.018 -0.021 -0.003
## prnt.empl.blOther                                      -0.001 -0.015 -0.030
## neighb_phenx_avg_p.bl.cm                                0.032  0.006  0.049
## overall.income.bl[>=50K & <100K]                       -0.024 -0.159 -0.275
## overall.income.bl[<50k]                                -0.081 -0.165 -0.419
## overall.income.bl[Don't Know or Refuse]                -0.066 -0.120 -0.293
## sex.blFemale                                           -0.020  0.009  0.009
## reshist_addr1_pm252016aa_bl.c5                          0.003  0.010 -0.013
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.007  0.013  0.008
##                                                        h..HSD h..<HD p..aHP
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                0.561              
## prnt.empl.blStay at Home Parent                        -0.052 -0.120       
## prnt.empl.blUnemployed                                 -0.084 -0.120  0.185
## prnt.empl.blOther                                      -0.024 -0.029  0.174
## neighb_phenx_avg_p.bl.cm                                0.045  0.052  0.041
## overall.income.bl[>=50K & <100K]                       -0.196 -0.157 -0.021
## overall.income.bl[<50k]                                -0.394 -0.377 -0.051
## overall.income.bl[Don't Know or Refuse]                -0.287 -0.269 -0.086
## sex.blFemale                                            0.013 -0.013  0.016
## reshist_addr1_pm252016aa_bl.c5                          0.009 -0.004 -0.005
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.001  0.028  0.018
##                                                        prn..U prn..O n___..
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                       0.160              
## neighb_phenx_avg_p.bl.cm                                0.030 -0.014       
## overall.income.bl[>=50K & <100K]                       -0.010 -0.039  0.054
## overall.income.bl[<50k]                                -0.081 -0.128  0.124
## overall.income.bl[Don't Know or Refuse]                -0.081 -0.112  0.071
## sex.blFemale                                            0.038  0.021  0.016
## reshist_addr1_pm252016aa_bl.c5                          0.004  0.001  0.044
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.007 -0.007  0.002
##                                                        o..[&< o..[<5 o..KoR
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                                          
## neighb_phenx_avg_p.bl.cm                                                   
## overall.income.bl[>=50K & <100K]                                           
## overall.income.bl[<50k]                                 0.553              
## overall.income.bl[Don't Know or Refuse]                 0.439  0.618       
## sex.blFemale                                            0.005  0.000 -0.004
## reshist_addr1_pm252016aa_bl.c5                         -0.012 -0.019 -0.035
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.013  0.013  0.023
##                                                        sx.blF r_1_25
## reshist_addr1_no2_2016_aavg_bl.c533                                 
## interview_age.c9.y                                                  
## race_ethnicity.blHispanic                                           
## race_ethnicity.blBlack                                              
## race_ethnicity.blOther                                              
## high.educ.blBachelor                                                
## high.educ.blSome College                                            
## high.educ.blHS Diploma/GED                                          
## high.educ.bl< HS Diploma                                            
## prnt.empl.blStay at Home Parent                                     
## prnt.empl.blUnemployed                                              
## prnt.empl.blOther                                                   
## neighb_phenx_avg_p.bl.cm                                            
## overall.income.bl[>=50K & <100K]                                    
## overall.income.bl[<50k]                                             
## overall.income.bl[Don't Know or Refuse]                             
## sex.blFemale                                                        
## reshist_addr1_pm252016aa_bl.c5                         -0.006       
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.001  0.002
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -1.6237448 -0.3365222 -0.2297828  0.2368846 38.4986943 
## 
## Number of Observations: 23857
## Number of Groups: 21
anova(anxdep_zinb_r)
##                                                        numDF denDF  F-value
## (Intercept)                                                1 14510 337.4840
## reshist_addr1_no2_2016_aavg_bl.c533                        1  9307   6.4051
## interview_age.c9.y                                         1 14510  22.0767
## race_ethnicity.bl                                          3  9307  31.6014
## high.educ.bl                                               4  9307   5.7196
## prnt.empl.bl                                               3  9307  10.2215
## neighb_phenx_avg_p.bl.cm                                   1  9307  86.9804
## overall.income.bl                                          3  9307   7.6772
## sex.bl                                                     1  9307   5.8714
## reshist_addr1_pm252016aa_bl.c5                             1  9307   2.5414
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y     1 14510   4.4220
##                                                        p-value
## (Intercept)                                             <.0001
## reshist_addr1_no2_2016_aavg_bl.c533                     0.0114
## interview_age.c9.y                                      <.0001
## race_ethnicity.bl                                       <.0001
## high.educ.bl                                            0.0001
## prnt.empl.bl                                            <.0001
## neighb_phenx_avg_p.bl.cm                                <.0001
## overall.income.bl                                       <.0001
## sex.bl                                                  0.0154
## reshist_addr1_pm252016aa_bl.c5                          0.1109
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.0355

Assumption checking for ZINB Models

#Check outlier/residuals with this df
anxdep_res <- df_cc
anxdep_res$level1_resid.raw <- residuals(anxdep_zinb_r)
anxdep_res$level1_resid.pearson <- residuals(anxdep_zinb_r, type="pearson")
#Add predicted values (Yhat)
anxdep_res$cbcl_scr_syn_anxdep_r_predicted <- predict(anxdep_zinb_r,anxdep_res,type="response")
#Incidence
anxdep_res$incidence <- estimate.probability(anxdep_res$cbcl_scr_syn_anxdep_r, method="empirical")

#Plotting histogram of residuals, but may be skewed since using ZINB, so make sure to check below plots
hist(anxdep_res$level1_resid.pearson)

### Incidence vs. X’s Plots

#age
ggplot(anxdep_res,aes(incidence,interview_age)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

#pm2.5
ggplot(anxdep_res,aes(incidence,reshist_addr1_no2_2016_aavg_bl)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

### Residuals vs Y (CBCL Outcome) Plot

plot(anxdep_res$level1_resid.pearson, anxdep_res$cbcl_scr_syn_anxdep_r)

### Residuals vs Yhat Plot

plot(anxdep_res$level1_resid.pearson, anxdep_res$cbcl_scr_syn_anxdep_r_predicted)

### Residuals vs Row Plot

plot(as.numeric(rownames(anxdep_res)),anxdep_res$level1_resid.pearson)

### Residuals vs X’s Plots

#age
ggplot(anxdep_res,aes(level1_resid.pearson,interview_age)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

#pm2.5
ggplot(anxdep_res,aes(level1_resid.pearson,reshist_addr1_no2_2016_aavg_bl)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

Withdrawn/Depressed

CBCL + AP Longitudinal Models

withdep_zinb_r <- glmm.zinb(cbcl_scr_syn_withdep_r ~ reshist_addr1_no2_2016_aavg_bl.c533*interview_age.c9.y + race_ethnicity.bl + high.educ.bl+ prnt.empl.bl  + neighb_phenx_avg_p.bl.cm + overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5, random = ~1|abcd_site/subjectid, 
              zi_fixed = ~ reshist_addr1_no2_2016_aavg_bl.c533*interview_age.c9.y + race_ethnicity.bl + high.educ.bl+ prnt.empl.bl  + neighb_phenx_avg_p.bl.cm + overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5, zi_random = ~1|abcd_site, data = df_cc)
## Computational iterations: 15 
## Computational time: 2.449 minutes
summary(withdep_zinb_r)
## Linear mixed-effects model fit by maximum likelihood
##   Data: df_cc 
##   AIC BIC logLik
##    NA  NA     NA
## 
## Random effects:
##  Formula: ~1 | abcd_site
##         (Intercept)
## StdDev:   0.1165096
## 
##  Formula: ~1 | subjectid %in% abcd_site
##         (Intercept)  Residual
## StdDev:    1.206034 0.8062692
## 
## Variance function:
##  Structure: fixed weights
##  Formula: ~invwt 
## Fixed effects:  cbcl_scr_syn_withdep_r ~ reshist_addr1_no2_2016_aavg_bl.c533 *      interview_age.c9.y + race_ethnicity.bl + high.educ.bl + prnt.empl.bl +      neighb_phenx_avg_p.bl.cm + overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5 
##                                                             Value  Std.Error
## (Intercept)                                            -0.8322451 0.07308345
## reshist_addr1_no2_2016_aavg_bl.c533                     0.0027451 0.00425703
## interview_age.c9.y                                      0.1410478 0.01680201
## race_ethnicity.blHispanic                              -0.0079277 0.04636865
## race_ethnicity.blBlack                                 -0.3077999 0.05232581
## race_ethnicity.blOther                                  0.0199279 0.04718400
## high.educ.blBachelor                                    0.0760802 0.04008946
## high.educ.blSome College                                0.1944957 0.04547859
## high.educ.blHS Diploma/GED                              0.0909375 0.06366743
## high.educ.bl< HS Diploma                                0.1295833 0.08124752
## prnt.empl.blStay at Home Parent                         0.0787774 0.04012553
## prnt.empl.blUnemployed                                  0.2378801 0.06480842
## prnt.empl.blOther                                       0.2796106 0.05706535
## neighb_phenx_avg_p.bl.cm                               -0.1453092 0.01673648
## overall.income.bl[>=50K & <100K]                        0.1598615 0.04040472
## overall.income.bl[<50k]                                 0.2816591 0.05029271
## overall.income.bl[Don't Know or Refuse]                 0.2425207 0.06313611
## sex.blFemale                                           -0.0721907 0.02947925
## reshist_addr1_pm252016aa_bl.c5                         -0.0103398 0.01389399
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.0035268 0.00115904
##                                                           DF    t-value p-value
## (Intercept)                                            14510 -11.387600  0.0000
## reshist_addr1_no2_2016_aavg_bl.c533                     9307   0.644840  0.5190
## interview_age.c9.y                                     14510   8.394695  0.0000
## race_ethnicity.blHispanic                               9307  -0.170971  0.8643
## race_ethnicity.blBlack                                  9307  -5.882372  0.0000
## race_ethnicity.blOther                                  9307   0.422345  0.6728
## high.educ.blBachelor                                    9307   1.897760  0.0578
## high.educ.blSome College                                9307   4.276642  0.0000
## high.educ.blHS Diploma/GED                              9307   1.428320  0.1532
## high.educ.bl< HS Diploma                                9307   1.594920  0.1108
## prnt.empl.blStay at Home Parent                         9307   1.963273  0.0496
## prnt.empl.blUnemployed                                  9307   3.670512  0.0002
## prnt.empl.blOther                                       9307   4.899831  0.0000
## neighb_phenx_avg_p.bl.cm                                9307  -8.682187  0.0000
## overall.income.bl[>=50K & <100K]                        9307   3.956506  0.0001
## overall.income.bl[<50k]                                 9307   5.600396  0.0000
## overall.income.bl[Don't Know or Refuse]                 9307   3.841236  0.0001
## sex.blFemale                                            9307  -2.448864  0.0143
## reshist_addr1_pm252016aa_bl.c5                          9307  -0.744193  0.4568
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y 14510  -3.042878  0.0023
##  Correlation: 
##                                                        (Intr) rs_1_2_2016__.533
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.647                  
## interview_age.c9.y                                     -0.416  0.460           
## race_ethnicity.blHispanic                              -0.020 -0.050           
## race_ethnicity.blBlack                                 -0.021 -0.067           
## race_ethnicity.blOther                                 -0.088 -0.021           
## high.educ.blBachelor                                   -0.195  0.011           
## high.educ.blSome College                               -0.136  0.021           
## high.educ.blHS Diploma/GED                             -0.080  0.006           
## high.educ.bl< HS Diploma                               -0.033 -0.015           
## prnt.empl.blStay at Home Parent                        -0.087  0.004           
## prnt.empl.blUnemployed                                 -0.026 -0.010           
## prnt.empl.blOther                                      -0.040 -0.002           
## neighb_phenx_avg_p.bl.cm                               -0.185  0.084           
## overall.income.bl[>=50K & <100K]                       -0.136 -0.009           
## overall.income.bl[<50k]                                -0.072 -0.012           
## overall.income.bl[Don't Know or Refuse]                -0.065 -0.005           
## sex.blFemale                                           -0.191 -0.001           
## reshist_addr1_pm252016aa_bl.c5                         -0.307 -0.207           
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.380 -0.497           
##                                                        in_.9. rc_t.H rc_t.B
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                              -0.001              
## race_ethnicity.blBlack                                  0.001  0.363       
## race_ethnicity.blOther                                  0.000  0.291  0.262
## high.educ.blBachelor                                   -0.004 -0.019 -0.013
## high.educ.blSome College                                0.001 -0.113 -0.089
## high.educ.blHS Diploma/GED                              0.003 -0.145 -0.149
## high.educ.bl< HS Diploma                               -0.005 -0.174 -0.076
## prnt.empl.blStay at Home Parent                         0.004  0.041  0.091
## prnt.empl.blUnemployed                                 -0.002  0.007 -0.042
## prnt.empl.blOther                                       0.004  0.042  0.011
## neighb_phenx_avg_p.bl.cm                               -0.007  0.030  0.140
## overall.income.bl[>=50K & <100K]                       -0.006 -0.088 -0.058
## overall.income.bl[<50k]                                -0.005 -0.145 -0.180
## overall.income.bl[Don't Know or Refuse]                -0.010 -0.103 -0.125
## sex.blFemale                                            0.001 -0.008 -0.015
## reshist_addr1_pm252016aa_bl.c5                         -0.005 -0.101 -0.046
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.922  0.004  0.004
##                                                        rc_t.O hgh..B hg..SC
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                   -0.001              
## high.educ.blSome College                               -0.024  0.464       
## high.educ.blHS Diploma/GED                             -0.008  0.341  0.508
## high.educ.bl< HS Diploma                               -0.009  0.273  0.421
## prnt.empl.blStay at Home Parent                         0.017 -0.027 -0.013
## prnt.empl.blUnemployed                                  0.009 -0.006 -0.007
## prnt.empl.blOther                                      -0.009 -0.011 -0.032
## neighb_phenx_avg_p.bl.cm                                0.041 -0.006  0.061
## overall.income.bl[>=50K & <100K]                       -0.008 -0.174 -0.276
## overall.income.bl[<50k]                                -0.078 -0.162 -0.418
## overall.income.bl[Don't Know or Refuse]                -0.062 -0.102 -0.255
## sex.blFemale                                           -0.018  0.017  0.024
## reshist_addr1_pm252016aa_bl.c5                         -0.038 -0.005 -0.023
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.002  0.004  0.000
##                                                        h..HSD h..<HD p..aHP
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                0.388              
## prnt.empl.blStay at Home Parent                        -0.050 -0.094       
## prnt.empl.blUnemployed                                 -0.068 -0.098  0.152
## prnt.empl.blOther                                      -0.008 -0.017  0.162
## neighb_phenx_avg_p.bl.cm                                0.057  0.051  0.027
## overall.income.bl[>=50K & <100K]                       -0.172 -0.116 -0.030
## overall.income.bl[<50k]                                -0.369 -0.312 -0.053
## overall.income.bl[Don't Know or Refuse]                -0.243 -0.226 -0.077
## sex.blFemale                                            0.015 -0.002 -0.005
## reshist_addr1_pm252016aa_bl.c5                         -0.014 -0.022 -0.019
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.001  0.007  0.001
##                                                        prn..U prn..O n___..
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                       0.135              
## neighb_phenx_avg_p.bl.cm                                0.018  0.005       
## overall.income.bl[>=50K & <100K]                       -0.017 -0.051  0.079
## overall.income.bl[<50k]                                -0.099 -0.142  0.150
## overall.income.bl[Don't Know or Refuse]                -0.080 -0.099  0.085
## sex.blFemale                                            0.018  0.020  0.030
## reshist_addr1_pm252016aa_bl.c5                         -0.004 -0.001  0.072
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.003 -0.002  0.005
##                                                        o..[&< o..[<5 o..KoR
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                                          
## neighb_phenx_avg_p.bl.cm                                                   
## overall.income.bl[>=50K & <100K]                                           
## overall.income.bl[<50k]                                 0.513              
## overall.income.bl[Don't Know or Refuse]                 0.369  0.497       
## sex.blFemale                                           -0.008 -0.006  0.007
## reshist_addr1_pm252016aa_bl.c5                         -0.016 -0.031 -0.031
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.007  0.006  0.011
##                                                        sx.blF r_1_25
## reshist_addr1_no2_2016_aavg_bl.c533                                 
## interview_age.c9.y                                                  
## race_ethnicity.blHispanic                                           
## race_ethnicity.blBlack                                              
## race_ethnicity.blOther                                              
## high.educ.blBachelor                                                
## high.educ.blSome College                                            
## high.educ.blHS Diploma/GED                                          
## high.educ.bl< HS Diploma                                            
## prnt.empl.blStay at Home Parent                                     
## prnt.empl.blUnemployed                                              
## prnt.empl.blOther                                                   
## neighb_phenx_avg_p.bl.cm                                            
## overall.income.bl[>=50K & <100K]                                    
## overall.income.bl[<50k]                                             
## overall.income.bl[Don't Know or Refuse]                             
## sex.blFemale                                                        
## reshist_addr1_pm252016aa_bl.c5                         -0.005       
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.001  0.005
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -2.7780502 -0.6294234 -0.5046226  0.3875329  4.6697641 
## 
## Number of Observations: 23857
## Number of Groups: 
##                abcd_site subjectid %in% abcd_site 
##                       21                     9345
summary(withdep_zinb_r$zi.fit)
## Linear mixed-effects model fit by maximum likelihood
##   Data: data 
##   AIC BIC logLik
##    NA  NA     NA
## 
## Random effects:
##  Formula: ~1 | abcd_site
##         (Intercept)  Residual
## StdDev:    0.547841 0.2646025
## 
## Variance function:
##  Structure: fixed weights
##  Formula: ~invwt 
## Fixed effects:  zp ~ reshist_addr1_no2_2016_aavg_bl.c533 * interview_age.c9.y +      race_ethnicity.bl + high.educ.bl + prnt.empl.bl + neighb_phenx_avg_p.bl.cm +      overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5 
##                                                            Value  Std.Error
## (Intercept)                                            -3.228797 0.13578132
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.028256 0.00438699
## interview_age.c9.y                                     -0.456696 0.02661509
## race_ethnicity.blHispanic                               0.177564 0.03308146
## race_ethnicity.blBlack                                  0.560545 0.03594629
## race_ethnicity.blOther                                  0.008858 0.03535556
## high.educ.blBachelor                                    0.264381 0.02666123
## high.educ.blSome College                                0.299023 0.03237184
## high.educ.blHS Diploma/GED                              0.180973 0.04899322
## high.educ.bl< HS Diploma                                0.620542 0.05834153
## prnt.empl.blStay at Home Parent                        -0.607917 0.03517397
## prnt.empl.blUnemployed                                 -0.142580 0.05011382
## prnt.empl.blOther                                      -0.035462 0.04305319
## neighb_phenx_avg_p.bl.cm                                0.462282 0.01401739
## overall.income.bl[>=50K & <100K]                       -0.495409 0.02935671
## overall.income.bl[<50k]                                -0.814584 0.03873933
## overall.income.bl[Don't Know or Refuse]                 0.327030 0.03743477
## sex.blFemale                                            0.211421 0.02084046
## reshist_addr1_pm252016aa_bl.c5                          0.067008 0.01223031
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.020050 0.00190085
##                                                           DF   t-value p-value
## (Intercept)                                            23817 -23.77939  0.0000
## reshist_addr1_no2_2016_aavg_bl.c533                    23817  -6.44089  0.0000
## interview_age.c9.y                                     23817 -17.15928  0.0000
## race_ethnicity.blHispanic                              23817   5.36749  0.0000
## race_ethnicity.blBlack                                 23817  15.59396  0.0000
## race_ethnicity.blOther                                 23817   0.25053  0.8022
## high.educ.blBachelor                                   23817   9.91630  0.0000
## high.educ.blSome College                               23817   9.23715  0.0000
## high.educ.blHS Diploma/GED                             23817   3.69384  0.0002
## high.educ.bl< HS Diploma                               23817  10.63637  0.0000
## prnt.empl.blStay at Home Parent                        23817 -17.28314  0.0000
## prnt.empl.blUnemployed                                 23817  -2.84512  0.0044
## prnt.empl.blOther                                      23817  -0.82368  0.4101
## neighb_phenx_avg_p.bl.cm                               23817  32.97919  0.0000
## overall.income.bl[>=50K & <100K]                       23817 -16.87549  0.0000
## overall.income.bl[<50k]                                23817 -21.02732  0.0000
## overall.income.bl[Don't Know or Refuse]                23817   8.73599  0.0000
## sex.blFemale                                           23817  10.14472  0.0000
## reshist_addr1_pm252016aa_bl.c5                         23817   5.47881  0.0000
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y 23817  10.54815  0.0000
##  Correlation: 
##                                                        (Intr) rs_1_2_2016__.533
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.349                  
## interview_age.c9.y                                     -0.299  0.629           
## race_ethnicity.blHispanic                              -0.021 -0.037           
## race_ethnicity.blBlack                                 -0.008 -0.084           
## race_ethnicity.blOther                                 -0.042 -0.025           
## high.educ.blBachelor                                   -0.076 -0.005           
## high.educ.blSome College                               -0.053  0.003           
## high.educ.blHS Diploma/GED                             -0.031 -0.008           
## high.educ.bl< HS Diploma                                0.000 -0.045           
## prnt.empl.blStay at Home Parent                        -0.029  0.000           
## prnt.empl.blUnemployed                                 -0.008 -0.016           
## prnt.empl.blOther                                      -0.012 -0.009           
## neighb_phenx_avg_p.bl.cm                               -0.095  0.077           
## overall.income.bl[>=50K & <100K]                       -0.025 -0.021           
## overall.income.bl[<50k]                                -0.008 -0.029           
## overall.income.bl[Don't Know or Refuse]                -0.008 -0.023           
## sex.blFemale                                           -0.080  0.004           
## reshist_addr1_pm252016aa_bl.c5                         -0.153 -0.200           
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.279 -0.705           
##                                                        in_.9. rc_t.H rc_t.B
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                               0.017              
## race_ethnicity.blBlack                                  0.008  0.354       
## race_ethnicity.blOther                                  0.010  0.278  0.230
## high.educ.blBachelor                                   -0.015 -0.007 -0.002
## high.educ.blSome College                               -0.003 -0.116 -0.107
## high.educ.blHS Diploma/GED                              0.009 -0.134 -0.141
## high.educ.bl< HS Diploma                               -0.021 -0.155 -0.074
## prnt.empl.blStay at Home Parent                         0.001  0.039  0.084
## prnt.empl.blUnemployed                                 -0.011  0.012 -0.025
## prnt.empl.blOther                                       0.001  0.036 -0.012
## neighb_phenx_avg_p.bl.cm                               -0.006  0.013  0.098
## overall.income.bl[>=50K & <100K]                       -0.006 -0.103 -0.088
## overall.income.bl[<50k]                                -0.008 -0.123 -0.192
## overall.income.bl[Don't Know or Refuse]                -0.016 -0.112 -0.168
## sex.blFemale                                           -0.001 -0.005 -0.015
## reshist_addr1_pm252016aa_bl.c5                         -0.013 -0.042 -0.008
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.917 -0.012  0.004
##                                                        rc_t.O hgh..B hg..SC
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                    0.014              
## high.educ.blSome College                                0.006  0.438       
## high.educ.blHS Diploma/GED                              0.004  0.298  0.439
## high.educ.bl< HS Diploma                                0.007  0.256  0.396
## prnt.empl.blStay at Home Parent                         0.020 -0.036 -0.020
## prnt.empl.blUnemployed                                  0.016 -0.023 -0.017
## prnt.empl.blOther                                      -0.023 -0.028 -0.042
## neighb_phenx_avg_p.bl.cm                                0.029 -0.004  0.047
## overall.income.bl[>=50K & <100K]                       -0.023 -0.140 -0.275
## overall.income.bl[<50k]                                -0.060 -0.114 -0.362
## overall.income.bl[Don't Know or Refuse]                -0.067 -0.094 -0.279
## sex.blFemale                                           -0.009  0.009  0.018
## reshist_addr1_pm252016aa_bl.c5                          0.004  0.011  0.002
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.007  0.009  0.002
##                                                        h..HSD h..<HD p..aHP
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                0.353              
## prnt.empl.blStay at Home Parent                        -0.046 -0.103       
## prnt.empl.blUnemployed                                 -0.066 -0.127  0.112
## prnt.empl.blOther                                      -0.024 -0.045  0.114
## neighb_phenx_avg_p.bl.cm                                0.030  0.039  0.012
## overall.income.bl[>=50K & <100K]                       -0.160 -0.106 -0.019
## overall.income.bl[<50k]                                -0.323 -0.316 -0.028
## overall.income.bl[Don't Know or Refuse]                -0.271 -0.267 -0.076
## sex.blFemale                                            0.006 -0.014  0.000
## reshist_addr1_pm252016aa_bl.c5                          0.014 -0.020  0.001
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.004  0.028  0.006
##                                                        prn..U prn..O n___..
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                       0.115              
## neighb_phenx_avg_p.bl.cm                                0.030 -0.018       
## overall.income.bl[>=50K & <100K]                       -0.009 -0.048  0.066
## overall.income.bl[<50k]                                -0.077 -0.115  0.109
## overall.income.bl[Don't Know or Refuse]                -0.079 -0.107  0.070
## sex.blFemale                                            0.029  0.010  0.028
## reshist_addr1_pm252016aa_bl.c5                          0.004  0.018  0.035
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.014  0.001  0.004
##                                                        o..[&< o..[<5 o..KoR
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                                          
## neighb_phenx_avg_p.bl.cm                                                   
## overall.income.bl[>=50K & <100K]                                           
## overall.income.bl[<50k]                                 0.405              
## overall.income.bl[Don't Know or Refuse]                 0.366  0.490       
## sex.blFemale                                           -0.019 -0.015  0.000
## reshist_addr1_pm252016aa_bl.c5                         -0.017 -0.016 -0.038
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.009  0.008  0.019
##                                                        sx.blF r_1_25
## reshist_addr1_no2_2016_aavg_bl.c533                                 
## interview_age.c9.y                                                  
## race_ethnicity.blHispanic                                           
## race_ethnicity.blBlack                                              
## race_ethnicity.blOther                                              
## high.educ.blBachelor                                                
## high.educ.blSome College                                            
## high.educ.blHS Diploma/GED                                          
## high.educ.bl< HS Diploma                                            
## prnt.empl.blStay at Home Parent                                     
## prnt.empl.blUnemployed                                              
## prnt.empl.blOther                                                   
## neighb_phenx_avg_p.bl.cm                                            
## overall.income.bl[>=50K & <100K]                                    
## overall.income.bl[<50k]                                             
## overall.income.bl[Don't Know or Refuse]                             
## sex.blFemale                                                        
## reshist_addr1_pm252016aa_bl.c5                         -0.011       
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.003  0.011
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -2.6396779 -0.4962796  0.1665693  0.2654016 42.1463544 
## 
## Number of Observations: 23857
## Number of Groups: 21
anova(withdep_zinb_r)
##                                                        numDF denDF   F-value
## (Intercept)                                                1 14510 228.46133
## reshist_addr1_no2_2016_aavg_bl.c533                        1  9307   0.51912
## interview_age.c9.y                                         1 14510 202.46829
## race_ethnicity.bl                                          3  9307   7.97398
## high.educ.bl                                               4  9307  28.21119
## prnt.empl.bl                                               3  9307  18.02121
## neighb_phenx_avg_p.bl.cm                                   1  9307  91.30046
## overall.income.bl                                          3  9307  11.31976
## sex.bl                                                     1  9307   6.00063
## reshist_addr1_pm252016aa_bl.c5                             1  9307   0.53123
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y     1 14510   9.25910
##                                                        p-value
## (Intercept)                                             <.0001
## reshist_addr1_no2_2016_aavg_bl.c533                     0.4712
## interview_age.c9.y                                      <.0001
## race_ethnicity.bl                                       <.0001
## high.educ.bl                                            <.0001
## prnt.empl.bl                                            <.0001
## neighb_phenx_avg_p.bl.cm                                <.0001
## overall.income.bl                                       <.0001
## sex.bl                                                  0.0143
## reshist_addr1_pm252016aa_bl.c5                          0.4661
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.0023

Assumption checking for ZINB Models

#Check outlier/residuals with this df
withdep_res <- df_cc
withdep_res$level1_resid.raw <- residuals(withdep_zinb_r)
withdep_res$level1_resid.pearson <- residuals(withdep_zinb_r, type="pearson")
#Add predicted values (Yhat)
withdep_res$cbcl_scr_syn_withdep_r_predicted <- predict(withdep_zinb_r,withdep_res,type="response")
#Incidence
withdep_res$incidence <- estimate.probability(withdep_res$cbcl_scr_syn_withdep_r, method="empirical")

#Plotting histogram of residuals, but may be skewed since using ZINB, so make sure to check below plots
hist(withdep_res$level1_resid.pearson)

### Incidence vs. X’s Plots

#age
ggplot(withdep_res,aes(incidence,interview_age)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : pseudoinverse used at 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : neighborhood radius 7.4176e-05
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : reciprocal condition number 1.0709e-14
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : There are other near singularities as well. 1.3755e-09
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used at 0
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius
## 7.4176e-05
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : reciprocal condition
## number 1.0709e-14
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : There are other near
## singularities as well. 1.3755e-09

#pm2.5
ggplot(withdep_res,aes(incidence,reshist_addr1_no2_2016_aavg_bl)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : pseudoinverse used at 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : neighborhood radius 7.4176e-05
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : reciprocal condition number 1.0709e-14
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : There are other near singularities as well. 1.3755e-09
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used at 0
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius
## 7.4176e-05
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : reciprocal condition
## number 1.0709e-14
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : There are other near
## singularities as well. 1.3755e-09

### Residuals vs Y (CBCL Outcome) Plot

plot(withdep_res$level1_resid.pearson, withdep_res$cbcl_scr_syn_withdep_r)

### Residuals vs Yhat Plot

plot(withdep_res$level1_resid.pearson, withdep_res$cbcl_scr_syn_withdep_r_predicted)

### Residuals vs Row Plot

plot(as.numeric(rownames(withdep_res)),withdep_res$level1_resid.pearson)

### Residuals vs X’s Plots

#age
ggplot(withdep_res,aes(level1_resid.pearson,interview_age)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

#pm2.5
ggplot(withdep_res,aes(level1_resid.pearson,reshist_addr1_no2_2016_aavg_bl)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

Attention

CBCL + AP Longitudinal Models

attention_zinb_r <- glmm.zinb(cbcl_scr_syn_attention_r ~ reshist_addr1_no2_2016_aavg_bl.c533*interview_age.c9.y + race_ethnicity.bl + high.educ.bl+ prnt.empl.bl  + neighb_phenx_avg_p.bl.cm + overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5, random = ~1|abcd_site/subjectid, 
              zi_fixed = ~ reshist_addr1_no2_2016_aavg_bl.c533*interview_age.c9.y + race_ethnicity.bl + high.educ.bl+ prnt.empl.bl  + neighb_phenx_avg_p.bl.cm + overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5, zi_random = ~1|abcd_site, data = df_cc)
## Computational iterations: 12 
## Computational time: 2.036 minutes
summary(attention_zinb_r)
## Linear mixed-effects model fit by maximum likelihood
##   Data: df_cc 
##   AIC BIC logLik
##    NA  NA     NA
## 
## Random effects:
##  Formula: ~1 | abcd_site
##         (Intercept)
## StdDev:   0.1343906
## 
##  Formula: ~1 | subjectid %in% abcd_site
##         (Intercept)  Residual
## StdDev:    1.141652 0.9027036
## 
## Variance function:
##  Structure: fixed weights
##  Formula: ~invwt 
## Fixed effects:  cbcl_scr_syn_attention_r ~ reshist_addr1_no2_2016_aavg_bl.c533 *      interview_age.c9.y + race_ethnicity.bl + high.educ.bl + prnt.empl.bl +      neighb_phenx_avg_p.bl.cm + overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5 
##                                                             Value  Std.Error
## (Intercept)                                             0.6918714 0.06649810
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.0010135 0.00373230
## interview_age.c9.y                                      0.0054682 0.01186184
## race_ethnicity.blHispanic                              -0.0495748 0.04153798
## race_ethnicity.blBlack                                 -0.0504005 0.04593407
## race_ethnicity.blOther                                  0.0646560 0.04199822
## high.educ.blBachelor                                    0.1526911 0.03532260
## high.educ.blSome College                                0.1932789 0.04036654
## high.educ.blHS Diploma/GED                              0.0641107 0.05665449
## high.educ.bl< HS Diploma                                0.0367784 0.07355647
## prnt.empl.blStay at Home Parent                        -0.0565876 0.03595366
## prnt.empl.blUnemployed                                  0.1399176 0.05817749
## prnt.empl.blOther                                       0.1854585 0.05121404
## neighb_phenx_avg_p.bl.cm                               -0.1196583 0.01496391
## overall.income.bl[>=50K & <100K]                        0.0812604 0.03576919
## overall.income.bl[<50k]                                 0.1552869 0.04480093
## overall.income.bl[Don't Know or Refuse]                 0.0473188 0.05619217
## sex.blFemale                                           -0.4356439 0.02619594
## reshist_addr1_pm252016aa_bl.c5                         -0.0090996 0.01314393
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.0030732 0.00082256
##                                                           DF    t-value p-value
## (Intercept)                                            14510  10.404379  0.0000
## reshist_addr1_no2_2016_aavg_bl.c533                     9307  -0.271535  0.7860
## interview_age.c9.y                                     14510   0.460993  0.6448
## race_ethnicity.blHispanic                               9307  -1.193481  0.2327
## race_ethnicity.blBlack                                  9307  -1.097235  0.2726
## race_ethnicity.blOther                                  9307   1.539495  0.1237
## high.educ.blBachelor                                    9307   4.322758  0.0000
## high.educ.blSome College                                9307   4.788097  0.0000
## high.educ.blHS Diploma/GED                              9307   1.131608  0.2578
## high.educ.bl< HS Diploma                                9307   0.500003  0.6171
## prnt.empl.blStay at Home Parent                         9307  -1.573903  0.1155
## prnt.empl.blUnemployed                                  9307   2.405013  0.0162
## prnt.empl.blOther                                       9307   3.621243  0.0003
## neighb_phenx_avg_p.bl.cm                                9307  -7.996456  0.0000
## overall.income.bl[>=50K & <100K]                        9307   2.271799  0.0231
## overall.income.bl[<50k]                                 9307   3.466154  0.0005
## overall.income.bl[Don't Know or Refuse]                 9307   0.842089  0.3998
## sex.blFemale                                            9307 -16.630203  0.0000
## reshist_addr1_pm252016aa_bl.c5                          9307  -0.692307  0.4888
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y 14510  -3.736148  0.0002
##  Correlation: 
##                                                        (Intr) rs_1_2_2016__.533
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.593                  
## interview_age.c9.y                                     -0.306  0.355           
## race_ethnicity.blHispanic                              -0.026 -0.055           
## race_ethnicity.blBlack                                 -0.022 -0.078           
## race_ethnicity.blOther                                 -0.086 -0.030           
## high.educ.blBachelor                                   -0.191  0.010           
## high.educ.blSome College                               -0.129  0.017           
## high.educ.blHS Diploma/GED                             -0.076  0.004           
## high.educ.bl< HS Diploma                               -0.030 -0.019           
## prnt.empl.blStay at Home Parent                        -0.085  0.006           
## prnt.empl.blUnemployed                                 -0.024 -0.012           
## prnt.empl.blOther                                      -0.039 -0.001           
## neighb_phenx_avg_p.bl.cm                               -0.185  0.092           
## overall.income.bl[>=50K & <100K]                       -0.128 -0.009           
## overall.income.bl[<50k]                                -0.064 -0.015           
## overall.income.bl[Don't Know or Refuse]                -0.061 -0.004           
## sex.blFemale                                           -0.182  0.000           
## reshist_addr1_pm252016aa_bl.c5                         -0.321 -0.235           
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.281 -0.385           
##                                                        in_.9. rc_t.H rc_t.B
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                               0.000              
## race_ethnicity.blBlack                                  0.002  0.356       
## race_ethnicity.blOther                                  0.000  0.287  0.263
## high.educ.blBachelor                                   -0.004 -0.017 -0.010
## high.educ.blSome College                               -0.001 -0.106 -0.079
## high.educ.blHS Diploma/GED                              0.001 -0.139 -0.143
## high.educ.bl< HS Diploma                               -0.005 -0.164 -0.072
## prnt.empl.blStay at Home Parent                         0.001  0.044  0.091
## prnt.empl.blUnemployed                                 -0.002  0.010 -0.041
## prnt.empl.blOther                                       0.002  0.041  0.009
## neighb_phenx_avg_p.bl.cm                               -0.004  0.028  0.138
## overall.income.bl[>=50K & <100K]                       -0.006 -0.089 -0.061
## overall.income.bl[<50k]                                -0.004 -0.143 -0.184
## overall.income.bl[Don't Know or Refuse]                -0.007 -0.097 -0.126
## sex.blFemale                                            0.002 -0.006 -0.017
## reshist_addr1_pm252016aa_bl.c5                         -0.005 -0.083 -0.032
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.922  0.002  0.002
##                                                        rc_t.O hgh..B hg..SC
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                    0.000              
## high.educ.blSome College                               -0.021  0.460       
## high.educ.blHS Diploma/GED                             -0.006  0.338  0.503
## high.educ.bl< HS Diploma                               -0.009  0.265  0.410
## prnt.empl.blStay at Home Parent                         0.016 -0.026 -0.013
## prnt.empl.blUnemployed                                  0.010 -0.010 -0.010
## prnt.empl.blOther                                      -0.014 -0.011 -0.033
## neighb_phenx_avg_p.bl.cm                                0.041 -0.003  0.062
## overall.income.bl[>=50K & <100K]                       -0.011 -0.173 -0.278
## overall.income.bl[<50k]                                -0.080 -0.161 -0.420
## overall.income.bl[Don't Know or Refuse]                -0.057 -0.101 -0.254
## sex.blFemale                                           -0.016  0.014  0.021
## reshist_addr1_pm252016aa_bl.c5                         -0.027  0.000 -0.017
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.001  0.003  0.001
##                                                        h..HSD h..<HD p..aHP
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                0.379              
## prnt.empl.blStay at Home Parent                        -0.050 -0.092       
## prnt.empl.blUnemployed                                 -0.069 -0.099  0.148
## prnt.empl.blOther                                      -0.013 -0.020  0.158
## neighb_phenx_avg_p.bl.cm                                0.057  0.053  0.026
## overall.income.bl[>=50K & <100K]                       -0.175 -0.114 -0.032
## overall.income.bl[<50k]                                -0.369 -0.310 -0.054
## overall.income.bl[Don't Know or Refuse]                -0.241 -0.219 -0.078
## sex.blFemale                                            0.014 -0.003 -0.005
## reshist_addr1_pm252016aa_bl.c5                         -0.010 -0.016 -0.017
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.002  0.006  0.002
##                                                        prn..U prn..O n___..
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                       0.133              
## neighb_phenx_avg_p.bl.cm                                0.019  0.002       
## overall.income.bl[>=50K & <100K]                       -0.016 -0.050  0.082
## overall.income.bl[<50k]                                -0.101 -0.138  0.150
## overall.income.bl[Don't Know or Refuse]                -0.079 -0.099  0.084
## sex.blFemale                                            0.019  0.020  0.029
## reshist_addr1_pm252016aa_bl.c5                         -0.002 -0.001  0.061
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.003 -0.001  0.003
##                                                        o..[&< o..[<5 o..KoR
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                                          
## neighb_phenx_avg_p.bl.cm                                                   
## overall.income.bl[>=50K & <100K]                                           
## overall.income.bl[<50k]                                 0.508              
## overall.income.bl[Don't Know or Refuse]                 0.363  0.488       
## sex.blFemale                                           -0.006 -0.008  0.006
## reshist_addr1_pm252016aa_bl.c5                         -0.017 -0.029 -0.030
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.006  0.004  0.008
##                                                        sx.blF r_1_25
## reshist_addr1_no2_2016_aavg_bl.c533                                 
## interview_age.c9.y                                                  
## race_ethnicity.blHispanic                                           
## race_ethnicity.blBlack                                              
## race_ethnicity.blOther                                              
## high.educ.blBachelor                                                
## high.educ.blSome College                                            
## high.educ.blHS Diploma/GED                                          
## high.educ.bl< HS Diploma                                            
## prnt.empl.blStay at Home Parent                                     
## prnt.empl.blUnemployed                                              
## prnt.empl.blOther                                                   
## neighb_phenx_avg_p.bl.cm                                            
## overall.income.bl[>=50K & <100K]                                    
## overall.income.bl[<50k]                                             
## overall.income.bl[Don't Know or Refuse]                             
## sex.blFemale                                                        
## reshist_addr1_pm252016aa_bl.c5                         -0.003       
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.000  0.005
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -2.5254727 -0.7140570 -0.2849287  0.4220626  3.6485327 
## 
## Number of Observations: 23857
## Number of Groups: 
##                abcd_site subjectid %in% abcd_site 
##                       21                     9345
summary(attention_zinb_r$zi.fit)
## Linear mixed-effects model fit by maximum likelihood
##   Data: data 
##   AIC BIC logLik
##    NA  NA     NA
## 
## Random effects:
##  Formula: ~1 | abcd_site
##         (Intercept)  Residual
## StdDev:   0.4941459 0.4157335
## 
## Variance function:
##  Structure: fixed weights
##  Formula: ~invwt 
## Fixed effects:  zp ~ reshist_addr1_no2_2016_aavg_bl.c533 * interview_age.c9.y +      race_ethnicity.bl + high.educ.bl + prnt.empl.bl + neighb_phenx_avg_p.bl.cm +      overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5 
##                                                            Value  Std.Error
## (Intercept)                                            -5.342355 0.17592724
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.000070 0.00921206
## interview_age.c9.y                                      0.295496 0.05056248
## race_ethnicity.blHispanic                               0.226115 0.06875477
## race_ethnicity.blBlack                                  0.707223 0.06715620
## race_ethnicity.blOther                                  0.384733 0.06743834
## high.educ.blBachelor                                    0.001124 0.06056197
## high.educ.blSome College                                0.216711 0.06798804
## high.educ.blHS Diploma/GED                              0.882153 0.08218212
## high.educ.bl< HS Diploma                                1.770432 0.08792922
## prnt.empl.blStay at Home Parent                         0.102400 0.05321638
## prnt.empl.blUnemployed                                 -0.380456 0.09020364
## prnt.empl.blOther                                      -0.245772 0.08651725
## neighb_phenx_avg_p.bl.cm                                0.406164 0.02452240
## overall.income.bl[>=50K & <100K]                       -0.325054 0.06254108
## overall.income.bl[<50k]                                -0.060002 0.07165680
## overall.income.bl[Don't Know or Refuse]                 0.073908 0.08229295
## sex.blFemale                                            0.725284 0.04188048
## reshist_addr1_pm252016aa_bl.c5                          0.077735 0.02224135
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.012898 0.00363482
##                                                           DF    t-value p-value
## (Intercept)                                            23817 -30.366842  0.0000
## reshist_addr1_no2_2016_aavg_bl.c533                    23817  -0.007630  0.9939
## interview_age.c9.y                                     23817   5.844185  0.0000
## race_ethnicity.blHispanic                              23817   3.288722  0.0010
## race_ethnicity.blBlack                                 23817  10.531023  0.0000
## race_ethnicity.blOther                                 23817   5.704965  0.0000
## high.educ.blBachelor                                   23817   0.018563  0.9852
## high.educ.blSome College                               23817   3.187482  0.0014
## high.educ.blHS Diploma/GED                             23817  10.734129  0.0000
## high.educ.bl< HS Diploma                               23817  20.134742  0.0000
## prnt.empl.blStay at Home Parent                        23817   1.924225  0.0543
## prnt.empl.blUnemployed                                 23817  -4.217745  0.0000
## prnt.empl.blOther                                      23817  -2.840730  0.0045
## neighb_phenx_avg_p.bl.cm                               23817  16.562961  0.0000
## overall.income.bl[>=50K & <100K]                       23817  -5.197454  0.0000
## overall.income.bl[<50k]                                23817  -0.837347  0.4024
## overall.income.bl[Don't Know or Refuse]                23817   0.898107  0.3691
## sex.blFemale                                           23817  17.317950  0.0000
## reshist_addr1_pm252016aa_bl.c5                         23817   3.495059  0.0005
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y 23817  -3.548481  0.0004
##  Correlation: 
##                                                        (Intr) rs_1_2_2016__.533
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.603                  
## interview_age.c9.y                                     -0.573  0.734           
## race_ethnicity.blHispanic                              -0.043 -0.042           
## race_ethnicity.blBlack                                 -0.037 -0.064           
## race_ethnicity.blOther                                 -0.082 -0.027           
## high.educ.blBachelor                                   -0.118 -0.009           
## high.educ.blSome College                               -0.085  0.003           
## high.educ.blHS Diploma/GED                             -0.068 -0.007           
## high.educ.bl< HS Diploma                               -0.026 -0.051           
## prnt.empl.blStay at Home Parent                        -0.063  0.001           
## prnt.empl.blUnemployed                                 -0.020 -0.009           
## prnt.empl.blOther                                      -0.023 -0.005           
## neighb_phenx_avg_p.bl.cm                               -0.129  0.060           
## overall.income.bl[>=50K & <100K]                       -0.057 -0.018           
## overall.income.bl[<50k]                                -0.028 -0.031           
## overall.income.bl[Don't Know or Refuse]                -0.022 -0.023           
## sex.blFemale                                           -0.154  0.003           
## reshist_addr1_pm252016aa_bl.c5                         -0.206 -0.187           
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.517 -0.786           
##                                                        in_.9. rc_t.H rc_t.B
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                               0.006              
## race_ethnicity.blBlack                                  0.025  0.449       
## race_ethnicity.blOther                                  0.016  0.357  0.342
## high.educ.blBachelor                                   -0.025 -0.008  0.002
## high.educ.blSome College                               -0.012 -0.103 -0.083
## high.educ.blHS Diploma/GED                              0.003 -0.156 -0.148
## high.educ.bl< HS Diploma                               -0.025 -0.187 -0.105
## prnt.empl.blStay at Home Parent                        -0.006  0.045  0.096
## prnt.empl.blUnemployed                                  0.000  0.017 -0.032
## prnt.empl.blOther                                       0.006  0.046 -0.007
## neighb_phenx_avg_p.bl.cm                                0.000  0.016  0.116
## overall.income.bl[>=50K & <100K]                       -0.008 -0.088 -0.091
## overall.income.bl[<50k]                                -0.005 -0.152 -0.210
## overall.income.bl[Don't Know or Refuse]                -0.012 -0.120 -0.154
## sex.blFemale                                            0.005 -0.001 -0.018
## reshist_addr1_pm252016aa_bl.c5                         -0.031 -0.047 -0.012
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.918  0.000 -0.015
##                                                        rc_t.O hgh..B hg..SC
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                    0.016              
## high.educ.blSome College                               -0.009  0.463       
## high.educ.blHS Diploma/GED                             -0.001  0.391  0.587
## high.educ.bl< HS Diploma                               -0.003  0.369  0.574
## prnt.empl.blStay at Home Parent                         0.032 -0.030 -0.014
## prnt.empl.blUnemployed                                 -0.002 -0.017 -0.004
## prnt.empl.blOther                                      -0.018 -0.016 -0.018
## neighb_phenx_avg_p.bl.cm                                0.026 -0.007  0.032
## overall.income.bl[>=50K & <100K]                       -0.037 -0.154 -0.302
## overall.income.bl[<50k]                                -0.092 -0.151 -0.429
## overall.income.bl[Don't Know or Refuse]                -0.078 -0.113 -0.311
## sex.blFemale                                           -0.012  0.006  0.009
## reshist_addr1_pm252016aa_bl.c5                          0.008  0.012 -0.016
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.012  0.023  0.017
##                                                        h..HSD h..<HD p..aHP
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                0.602              
## prnt.empl.blStay at Home Parent                        -0.049 -0.111       
## prnt.empl.blUnemployed                                 -0.060 -0.110  0.171
## prnt.empl.blOther                                      -0.006 -0.043  0.159
## neighb_phenx_avg_p.bl.cm                                0.037  0.062  0.040
## overall.income.bl[>=50K & <100K]                       -0.229 -0.192 -0.020
## overall.income.bl[<50k]                                -0.444 -0.448 -0.043
## overall.income.bl[Don't Know or Refuse]                -0.343 -0.358 -0.087
## sex.blFemale                                            0.008 -0.001  0.012
## reshist_addr1_pm252016aa_bl.c5                          0.014 -0.004 -0.004
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.007  0.032  0.016
##                                                        prn..U prn..O n___..
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                       0.127              
## neighb_phenx_avg_p.bl.cm                                0.031 -0.013       
## overall.income.bl[>=50K & <100K]                       -0.008 -0.043  0.055
## overall.income.bl[<50k]                                -0.054 -0.115  0.123
## overall.income.bl[Don't Know or Refuse]                -0.057 -0.094  0.072
## sex.blFemale                                            0.035  0.011  0.018
## reshist_addr1_pm252016aa_bl.c5                          0.004  0.015  0.036
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.003 -0.002 -0.001
##                                                        o..[&< o..[<5 o..KoR
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                                          
## neighb_phenx_avg_p.bl.cm                                                   
## overall.income.bl[>=50K & <100K]                                           
## overall.income.bl[<50k]                                 0.512              
## overall.income.bl[Don't Know or Refuse]                 0.412  0.620       
## sex.blFemale                                           -0.016 -0.008 -0.013
## reshist_addr1_pm252016aa_bl.c5                         -0.010 -0.014 -0.036
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.011  0.007  0.022
##                                                        sx.blF r_1_25
## reshist_addr1_no2_2016_aavg_bl.c533                                 
## interview_age.c9.y                                                  
## race_ethnicity.blHispanic                                           
## race_ethnicity.blBlack                                              
## race_ethnicity.blOther                                              
## high.educ.blBachelor                                                
## high.educ.blSome College                                            
## high.educ.blHS Diploma/GED                                          
## high.educ.bl< HS Diploma                                            
## prnt.empl.blStay at Home Parent                                     
## prnt.empl.blUnemployed                                              
## prnt.empl.blOther                                                   
## neighb_phenx_avg_p.bl.cm                                            
## overall.income.bl[>=50K & <100K]                                    
## overall.income.bl[<50k]                                             
## overall.income.bl[Don't Know or Refuse]                             
## sex.blFemale                                                        
## reshist_addr1_pm252016aa_bl.c5                         -0.013       
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.002  0.034
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -1.4743983 -0.2995141 -0.2050831  0.1868958 33.1131250 
## 
## Number of Observations: 23857
## Number of Groups: 21
anova(attention_zinb_r)
##                                                        numDF denDF   F-value
## (Intercept)                                                1 14510 307.37217
## reshist_addr1_no2_2016_aavg_bl.c533                        1  9307   0.06255
## interview_age.c9.y                                         1 14510  59.40404
## race_ethnicity.bl                                          3  9307   4.88782
## high.educ.bl                                               4  9307  21.70167
## prnt.empl.bl                                               3  9307  11.45021
## neighb_phenx_avg_p.bl.cm                                   1  9307  65.16174
## overall.income.bl                                          3  9307   4.08005
## sex.bl                                                     1  9307 276.63212
## reshist_addr1_pm252016aa_bl.c5                             1  9307   0.45290
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y     1 14510  13.95880
##                                                        p-value
## (Intercept)                                             <.0001
## reshist_addr1_no2_2016_aavg_bl.c533                     0.8025
## interview_age.c9.y                                      <.0001
## race_ethnicity.bl                                       0.0021
## high.educ.bl                                            <.0001
## prnt.empl.bl                                            <.0001
## neighb_phenx_avg_p.bl.cm                                <.0001
## overall.income.bl                                       0.0066
## sex.bl                                                  <.0001
## reshist_addr1_pm252016aa_bl.c5                          0.5010
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.0002

Assumption checking for ZINB Models

#Check outlier/residuals with this df
attention_res <- df_cc
attention_res$level1_resid.raw <- residuals(attention_zinb_r)
attention_res$level1_resid.pearson <- residuals(attention_zinb_r, type="pearson")
#Add predicted values (Yhat)
attention_res$cbcl_scr_syn_attention_r_predicted <- predict(attention_zinb_r,attention_res,type="response")
#Incidence
attention_res$incidence <- estimate.probability(attention_res$cbcl_scr_syn_attention_r, method="empirical")

#Plotting histogram of residuals, but may be skewed since using ZINB, so make sure to check below plots
hist(attention_res$level1_resid.pearson)

### Incidence vs. X’s Plots

#age
ggplot(attention_res,aes(incidence,interview_age)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

#pm2.5
ggplot(attention_res,aes(incidence,reshist_addr1_no2_2016_aavg_bl)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

### Residuals vs Y (CBCL Outcome) Plot

plot(attention_res$level1_resid.pearson, attention_res$cbcl_scr_syn_attention_r)

### Residuals vs Yhat Plot

plot(attention_res$level1_resid.pearson, attention_res$cbcl_scr_syn_attention_r_predicted)

### Residuals vs Row Plot

plot(as.numeric(rownames(attention_res)),attention_res$level1_resid.pearson)

### Residuals vs X’s Plots

#age
ggplot(attention_res,aes(level1_resid.pearson,interview_age)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

#pm2.5
ggplot(attention_res,aes(level1_resid.pearson,reshist_addr1_no2_2016_aavg_bl)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

Rulebreak

CBCL + AP Longitudinal Models

rulebreak_zinb_r <- glmm.zinb(cbcl_scr_syn_rulebreak_r ~ reshist_addr1_no2_2016_aavg_bl.c533*interview_age.c9.y + race_ethnicity.bl + high.educ.bl+ prnt.empl.bl  + neighb_phenx_avg_p.bl.cm + overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5, random = ~1|abcd_site/subjectid, 
              zi_fixed = ~ reshist_addr1_no2_2016_aavg_bl.c533*interview_age.c9.y + race_ethnicity.bl + high.educ.bl+ prnt.empl.bl  + neighb_phenx_avg_p.bl.cm + overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5, zi_random = ~1|abcd_site, data = df_cc)
## Computational iterations: 14 
## Computational time: 2.159 minutes
summary(rulebreak_zinb_r)
## Linear mixed-effects model fit by maximum likelihood
##   Data: df_cc 
##   AIC BIC logLik
##    NA  NA     NA
## 
## Random effects:
##  Formula: ~1 | abcd_site
##         (Intercept)
## StdDev:   0.1321049
## 
##  Formula: ~1 | subjectid %in% abcd_site
##         (Intercept)  Residual
## StdDev:    1.194599 0.7884133
## 
## Variance function:
##  Structure: fixed weights
##  Formula: ~invwt 
## Fixed effects:  cbcl_scr_syn_rulebreak_r ~ reshist_addr1_no2_2016_aavg_bl.c533 *      interview_age.c9.y + race_ethnicity.bl + high.educ.bl + prnt.empl.bl +      neighb_phenx_avg_p.bl.cm + overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5 
##                                                             Value  Std.Error
## (Intercept)                                            -0.4912201 0.07412943
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.0005020 0.00427253
## interview_age.c9.y                                      0.0074437 0.01663129
## race_ethnicity.blHispanic                              -0.0623206 0.04608818
## race_ethnicity.blBlack                                  0.1010679 0.05035438
## race_ethnicity.blOther                                  0.0846763 0.04679435
## high.educ.blBachelor                                    0.1787266 0.03984533
## high.educ.blSome College                                0.3271039 0.04488209
## high.educ.blHS Diploma/GED                              0.1886083 0.06240523
## high.educ.bl< HS Diploma                                0.2283211 0.08016645
## prnt.empl.blStay at Home Parent                        -0.0321069 0.04010330
## prnt.empl.blUnemployed                                  0.1796452 0.06338742
## prnt.empl.blOther                                       0.2557162 0.05602700
## neighb_phenx_avg_p.bl.cm                               -0.1234932 0.01652115
## overall.income.bl[>=50K & <100K]                        0.1482135 0.04018522
## overall.income.bl[<50k]                                 0.3300615 0.04962171
## overall.income.bl[Don't Know or Refuse]                 0.2590148 0.06203115
## sex.blFemale                                           -0.4232865 0.02924360
## reshist_addr1_pm252016aa_bl.c5                         -0.0211510 0.01418141
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.0029204 0.00115567
##                                                           DF    t-value p-value
## (Intercept)                                            14510  -6.626520  0.0000
## reshist_addr1_no2_2016_aavg_bl.c533                     9307  -0.117483  0.9065
## interview_age.c9.y                                     14510   0.447570  0.6545
## race_ethnicity.blHispanic                               9307  -1.352203  0.1763
## race_ethnicity.blBlack                                  9307   2.007132  0.0448
## race_ethnicity.blOther                                  9307   1.809542  0.0704
## high.educ.blBachelor                                    9307   4.485509  0.0000
## high.educ.blSome College                                9307   7.288070  0.0000
## high.educ.blHS Diploma/GED                              9307   3.022316  0.0025
## high.educ.bl< HS Diploma                                9307   2.848087  0.0044
## prnt.empl.blStay at Home Parent                         9307  -0.800604  0.4234
## prnt.empl.blUnemployed                                  9307   2.834082  0.0046
## prnt.empl.blOther                                       9307   4.564161  0.0000
## neighb_phenx_avg_p.bl.cm                                9307  -7.474856  0.0000
## overall.income.bl[>=50K & <100K]                        9307   3.688259  0.0002
## overall.income.bl[<50k]                                 9307   6.651554  0.0000
## overall.income.bl[Don't Know or Refuse]                 9307   4.175560  0.0000
## sex.blFemale                                            9307 -14.474497  0.0000
## reshist_addr1_pm252016aa_bl.c5                          9307  -1.491463  0.1359
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y 14510  -2.527054  0.0115
##  Correlation: 
##                                                        (Intr) rs_1_2_2016__.533
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.631                  
## interview_age.c9.y                                     -0.386  0.437           
## race_ethnicity.blHispanic                              -0.019 -0.057           
## race_ethnicity.blBlack                                 -0.019 -0.075           
## race_ethnicity.blOther                                 -0.085 -0.026           
## high.educ.blBachelor                                   -0.195  0.009           
## high.educ.blSome College                               -0.138  0.019           
## high.educ.blHS Diploma/GED                             -0.083  0.006           
## high.educ.bl< HS Diploma                               -0.035 -0.017           
## prnt.empl.blStay at Home Parent                        -0.083  0.002           
## prnt.empl.blUnemployed                                 -0.024 -0.013           
## prnt.empl.blOther                                      -0.037 -0.003           
## neighb_phenx_avg_p.bl.cm                               -0.183  0.086           
## overall.income.bl[>=50K & <100K]                       -0.133 -0.009           
## overall.income.bl[<50k]                                -0.071 -0.012           
## overall.income.bl[Don't Know or Refuse]                -0.066 -0.005           
## sex.blFemale                                           -0.175  0.001           
## reshist_addr1_pm252016aa_bl.c5                         -0.312 -0.213           
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.354 -0.471           
##                                                        in_.9. rc_t.H rc_t.B
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                               0.001              
## race_ethnicity.blBlack                                  0.002  0.367       
## race_ethnicity.blOther                                  0.001  0.293  0.273
## high.educ.blBachelor                                   -0.004 -0.020 -0.012
## high.educ.blSome College                                0.000 -0.106 -0.080
## high.educ.blHS Diploma/GED                              0.003 -0.143 -0.146
## high.educ.bl< HS Diploma                               -0.007 -0.167 -0.076
## prnt.empl.blStay at Home Parent                         0.004  0.043  0.093
## prnt.empl.blUnemployed                                 -0.002  0.012 -0.038
## prnt.empl.blOther                                       0.003  0.047  0.016
## neighb_phenx_avg_p.bl.cm                               -0.004  0.034  0.140
## overall.income.bl[>=50K & <100K]                       -0.008 -0.091 -0.066
## overall.income.bl[<50k]                                -0.005 -0.146 -0.186
## overall.income.bl[Don't Know or Refuse]                -0.010 -0.101 -0.128
## sex.blFemale                                            0.002 -0.008 -0.019
## reshist_addr1_pm252016aa_bl.c5                         -0.006 -0.092 -0.042
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.924  0.002  0.003
##                                                        rc_t.O hgh..B hg..SC
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                    0.001              
## high.educ.blSome College                               -0.021  0.473       
## high.educ.blHS Diploma/GED                             -0.008  0.351  0.516
## high.educ.bl< HS Diploma                               -0.011  0.278  0.423
## prnt.empl.blStay at Home Parent                         0.016 -0.030 -0.016
## prnt.empl.blUnemployed                                  0.010 -0.008 -0.008
## prnt.empl.blOther                                      -0.011 -0.013 -0.034
## neighb_phenx_avg_p.bl.cm                                0.046 -0.003  0.061
## overall.income.bl[>=50K & <100K]                       -0.015 -0.171 -0.275
## overall.income.bl[<50k]                                -0.080 -0.161 -0.420
## overall.income.bl[Don't Know or Refuse]                -0.057 -0.101 -0.258
## sex.blFemale                                           -0.016  0.011  0.022
## reshist_addr1_pm252016aa_bl.c5                         -0.035 -0.001 -0.018
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.001  0.004  0.001
##                                                        h..HSD h..<HD p..aHP
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                0.389              
## prnt.empl.blStay at Home Parent                        -0.051 -0.099       
## prnt.empl.blUnemployed                                 -0.068 -0.100  0.152
## prnt.empl.blOther                                      -0.016 -0.023  0.162
## neighb_phenx_avg_p.bl.cm                                0.054  0.050  0.030
## overall.income.bl[>=50K & <100K]                       -0.175 -0.116 -0.028
## overall.income.bl[<50k]                                -0.367 -0.310 -0.050
## overall.income.bl[Don't Know or Refuse]                -0.244 -0.222 -0.070
## sex.blFemale                                            0.014 -0.003 -0.007
## reshist_addr1_pm252016aa_bl.c5                         -0.010 -0.016 -0.018
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.001  0.008  0.000
##                                                        prn..U prn..O n___..
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                       0.138              
## neighb_phenx_avg_p.bl.cm                                0.023  0.003       
## overall.income.bl[>=50K & <100K]                       -0.015 -0.049  0.079
## overall.income.bl[<50k]                                -0.102 -0.140  0.151
## overall.income.bl[Don't Know or Refuse]                -0.082 -0.101  0.084
## sex.blFemale                                            0.014  0.017  0.031
## reshist_addr1_pm252016aa_bl.c5                         -0.002 -0.001  0.065
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.003 -0.001  0.003
##                                                        o..[&< o..[<5 o..KoR
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                                          
## neighb_phenx_avg_p.bl.cm                                                   
## overall.income.bl[>=50K & <100K]                                           
## overall.income.bl[<50k]                                 0.519              
## overall.income.bl[Don't Know or Refuse]                 0.375  0.503       
## sex.blFemale                                           -0.010 -0.010  0.004
## reshist_addr1_pm252016aa_bl.c5                         -0.016 -0.029 -0.029
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.008  0.005  0.010
##                                                        sx.blF r_1_25
## reshist_addr1_no2_2016_aavg_bl.c533                                 
## interview_age.c9.y                                                  
## race_ethnicity.blHispanic                                           
## race_ethnicity.blBlack                                              
## race_ethnicity.blOther                                              
## high.educ.blBachelor                                                
## high.educ.blSome College                                            
## high.educ.blHS Diploma/GED                                          
## high.educ.bl< HS Diploma                                            
## prnt.empl.blStay at Home Parent                                     
## prnt.empl.blUnemployed                                              
## prnt.empl.blOther                                                   
## neighb_phenx_avg_p.bl.cm                                            
## overall.income.bl[>=50K & <100K]                                    
## overall.income.bl[<50k]                                             
## overall.income.bl[Don't Know or Refuse]                             
## sex.blFemale                                                        
## reshist_addr1_pm252016aa_bl.c5                         -0.007       
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.001  0.006
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -3.0046648 -0.6415376 -0.4926786  0.3911059  3.9448317 
## 
## Number of Observations: 23857
## Number of Groups: 
##                abcd_site subjectid %in% abcd_site 
##                       21                     9345
summary(rulebreak_zinb_r$zi.fit)
## Linear mixed-effects model fit by maximum likelihood
##   Data: data 
##   AIC BIC logLik
##    NA  NA     NA
## 
## Random effects:
##  Formula: ~1 | abcd_site
##         (Intercept)  Residual
## StdDev:   0.4409472 0.2695416
## 
## Variance function:
##  Structure: fixed weights
##  Formula: ~invwt 
## Fixed effects:  zp ~ reshist_addr1_no2_2016_aavg_bl.c533 * interview_age.c9.y +      race_ethnicity.bl + high.educ.bl + prnt.empl.bl + neighb_phenx_avg_p.bl.cm +      overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5 
##                                                            Value  Std.Error
## (Intercept)                                            -4.366761 0.12003000
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.012384 0.00487815
## interview_age.c9.y                                      0.081746 0.02577645
## race_ethnicity.blHispanic                               0.194187 0.03368794
## race_ethnicity.blBlack                                 -0.182735 0.04617739
## race_ethnicity.blOther                                 -0.055407 0.03467836
## high.educ.blBachelor                                   -0.268501 0.02683815
## high.educ.blSome College                               -0.649769 0.03657857
## high.educ.blHS Diploma/GED                             -0.134261 0.04848139
## high.educ.bl< HS Diploma                               -0.008910 0.05773665
## prnt.empl.blStay at Home Parent                         0.004042 0.02893617
## prnt.empl.blUnemployed                                 -0.162720 0.05751080
## prnt.empl.blOther                                      -0.087832 0.04874062
## neighb_phenx_avg_p.bl.cm                                0.369939 0.01419617
## overall.income.bl[>=50K & <100K]                       -0.261636 0.02932583
## overall.income.bl[<50k]                                -0.073323 0.03837333
## overall.income.bl[Don't Know or Refuse]                 0.346592 0.04138709
## sex.blFemale                                            1.162055 0.02350199
## reshist_addr1_pm252016aa_bl.c5                         -0.005680 0.01218632
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.012589 0.00183159
##                                                           DF   t-value p-value
## (Intercept)                                            23817 -36.38058  0.0000
## reshist_addr1_no2_2016_aavg_bl.c533                    23817  -2.53870  0.0111
## interview_age.c9.y                                     23817   3.17136  0.0015
## race_ethnicity.blHispanic                              23817   5.76430  0.0000
## race_ethnicity.blBlack                                 23817  -3.95724  0.0001
## race_ethnicity.blOther                                 23817  -1.59775  0.1101
## high.educ.blBachelor                                   23817 -10.00446  0.0000
## high.educ.blSome College                               23817 -17.76365  0.0000
## high.educ.blHS Diploma/GED                             23817  -2.76934  0.0056
## high.educ.bl< HS Diploma                               23817  -0.15432  0.8774
## prnt.empl.blStay at Home Parent                        23817   0.13969  0.8889
## prnt.empl.blUnemployed                                 23817  -2.82938  0.0047
## prnt.empl.blOther                                      23817  -1.80203  0.0716
## neighb_phenx_avg_p.bl.cm                               23817  26.05911  0.0000
## overall.income.bl[>=50K & <100K]                       23817  -8.92170  0.0000
## overall.income.bl[<50k]                                23817  -1.91079  0.0560
## overall.income.bl[Don't Know or Refuse]                23817   8.37439  0.0000
## sex.blFemale                                           23817  49.44494  0.0000
## reshist_addr1_pm252016aa_bl.c5                         23817  -0.46610  0.6412
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y 23817   6.87300  0.0000
##  Correlation: 
##                                                        (Intr) rs_1_2_2016__.533
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.457                  
## interview_age.c9.y                                     -0.418  0.682           
## race_ethnicity.blHispanic                              -0.024 -0.028           
## race_ethnicity.blBlack                                 -0.014 -0.050           
## race_ethnicity.blOther                                 -0.044 -0.018           
## high.educ.blBachelor                                   -0.061 -0.003           
## high.educ.blSome College                               -0.032  0.006           
## high.educ.blHS Diploma/GED                             -0.015 -0.010           
## high.educ.bl< HS Diploma                                0.020 -0.043           
## prnt.empl.blStay at Home Parent                        -0.044  0.008           
## prnt.empl.blUnemployed                                 -0.014 -0.006           
## prnt.empl.blOther                                      -0.017 -0.003           
## neighb_phenx_avg_p.bl.cm                               -0.115  0.080           
## overall.income.bl[>=50K & <100K]                       -0.046 -0.014           
## overall.income.bl[<50k]                                -0.019 -0.025           
## overall.income.bl[Don't Know or Refuse]                -0.021 -0.015           
## sex.blFemale                                           -0.149  0.012           
## reshist_addr1_pm252016aa_bl.c5                         -0.154 -0.202           
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.384 -0.758           
##                                                        in_.9. rc_t.H rc_t.B
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                               0.011              
## race_ethnicity.blBlack                                  0.009  0.286       
## race_ethnicity.blOther                                 -0.002  0.283  0.179
## high.educ.blBachelor                                   -0.019 -0.005 -0.007
## high.educ.blSome College                               -0.008 -0.127 -0.085
## high.educ.blHS Diploma/GED                             -0.001 -0.180 -0.135
## high.educ.bl< HS Diploma                               -0.029 -0.195 -0.077
## prnt.empl.blStay at Home Parent                         0.004  0.050  0.076
## prnt.empl.blUnemployed                                 -0.001  0.002 -0.038
## prnt.empl.blOther                                       0.008  0.030 -0.011
## neighb_phenx_avg_p.bl.cm                               -0.001  0.016  0.086
## overall.income.bl[>=50K & <100K]                       -0.014 -0.090 -0.059
## overall.income.bl[<50k]                                -0.009 -0.128 -0.147
## overall.income.bl[Don't Know or Refuse]                -0.011 -0.095 -0.098
## sex.blFemale                                            0.013 -0.003 -0.013
## reshist_addr1_pm252016aa_bl.c5                         -0.009 -0.049 -0.007
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.914 -0.004  0.000
##                                                        rc_t.O hgh..B hg..SC
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                    0.008              
## high.educ.blSome College                               -0.003  0.339       
## high.educ.blHS Diploma/GED                              0.001  0.267  0.401
## high.educ.bl< HS Diploma                                0.010  0.232  0.372
## prnt.empl.blStay at Home Parent                         0.014 -0.041 -0.028
## prnt.empl.blUnemployed                                  0.005 -0.016 -0.015
## prnt.empl.blOther                                      -0.024 -0.030 -0.026
## neighb_phenx_avg_p.bl.cm                                0.020 -0.015  0.038
## overall.income.bl[>=50K & <100K]                       -0.015 -0.145 -0.224
## overall.income.bl[<50k]                                -0.063 -0.143 -0.379
## overall.income.bl[Don't Know or Refuse]                -0.065 -0.092 -0.225
## sex.blFemale                                           -0.015  0.005  0.004
## reshist_addr1_pm252016aa_bl.c5                          0.002  0.005 -0.015
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.003  0.015  0.005
##                                                        h..HSD h..<HD p..aHP
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                0.396              
## prnt.empl.blStay at Home Parent                        -0.072 -0.125       
## prnt.empl.blUnemployed                                 -0.056 -0.097  0.130
## prnt.empl.blOther                                       0.004 -0.027  0.136
## neighb_phenx_avg_p.bl.cm                                0.038  0.052  0.025
## overall.income.bl[>=50K & <100K]                       -0.135 -0.090 -0.016
## overall.income.bl[<50k]                                -0.391 -0.352 -0.021
## overall.income.bl[Don't Know or Refuse]                -0.262 -0.238 -0.082
## sex.blFemale                                           -0.002 -0.012  0.000
## reshist_addr1_pm252016aa_bl.c5                         -0.004 -0.040 -0.012
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.007  0.034  0.005
##                                                        prn..U prn..O n___..
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                       0.097              
## neighb_phenx_avg_p.bl.cm                                0.025  0.000       
## overall.income.bl[>=50K & <100K]                       -0.009 -0.051  0.090
## overall.income.bl[<50k]                                -0.071 -0.132  0.114
## overall.income.bl[Don't Know or Refuse]                -0.059 -0.097  0.071
## sex.blFemale                                            0.026  0.010  0.034
## reshist_addr1_pm252016aa_bl.c5                         -0.003  0.013  0.041
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.004 -0.007  0.001
##                                                        o..[&< o..[<5 o..KoR
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                                          
## neighb_phenx_avg_p.bl.cm                                                   
## overall.income.bl[>=50K & <100K]                                           
## overall.income.bl[<50k]                                 0.385              
## overall.income.bl[Don't Know or Refuse]                 0.300  0.449       
## sex.blFemale                                           -0.014 -0.004  0.014
## reshist_addr1_pm252016aa_bl.c5                          0.004 -0.009 -0.024
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.019  0.011  0.015
##                                                        sx.blF r_1_25
## reshist_addr1_no2_2016_aavg_bl.c533                                 
## interview_age.c9.y                                                  
## race_ethnicity.blHispanic                                           
## race_ethnicity.blBlack                                              
## race_ethnicity.blOther                                              
## high.educ.blBachelor                                                
## high.educ.blSome College                                            
## high.educ.blHS Diploma/GED                                          
## high.educ.bl< HS Diploma                                            
## prnt.empl.blStay at Home Parent                                     
## prnt.empl.blUnemployed                                              
## prnt.empl.blOther                                                   
## neighb_phenx_avg_p.bl.cm                                            
## overall.income.bl[>=50K & <100K]                                    
## overall.income.bl[<50k]                                             
## overall.income.bl[Don't Know or Refuse]                             
## sex.blFemale                                                        
## reshist_addr1_pm252016aa_bl.c5                         -0.009       
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.006  0.008
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -2.0557332 -0.4567171  0.1607592  0.2683931 43.1419566 
## 
## Number of Observations: 23857
## Number of Groups: 21
anova(rulebreak_zinb_r)
##                                                        numDF denDF   F-value
## (Intercept)                                                1 14510 174.74978
## reshist_addr1_no2_2016_aavg_bl.c533                        1  9307   1.27584
## interview_age.c9.y                                         1 14510  26.30264
## race_ethnicity.bl                                          3  9307  30.06986
## high.educ.bl                                               4  9307  49.62558
## prnt.empl.bl                                               3  9307  16.73247
## neighb_phenx_avg_p.bl.cm                                   1  9307  64.61964
## overall.income.bl                                          3  9307  14.37416
## sex.bl                                                     1  9307 209.72445
## reshist_addr1_pm252016aa_bl.c5                             1  9307   2.18185
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y     1 14510   6.38600
##                                                        p-value
## (Intercept)                                             <.0001
## reshist_addr1_no2_2016_aavg_bl.c533                     0.2587
## interview_age.c9.y                                      <.0001
## race_ethnicity.bl                                       <.0001
## high.educ.bl                                            <.0001
## prnt.empl.bl                                            <.0001
## neighb_phenx_avg_p.bl.cm                                <.0001
## overall.income.bl                                       <.0001
## sex.bl                                                  <.0001
## reshist_addr1_pm252016aa_bl.c5                          0.1397
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.0115

Assumption checking for ZINB Models

#Check outlier/residuals with this df
rulebreak_res <- df_cc
rulebreak_res$level1_resid.raw <- residuals(rulebreak_zinb_r)
rulebreak_res$level1_resid.pearson <- residuals(rulebreak_zinb_r, type="pearson")
#Add predicted values (Yhat)
rulebreak_res$cbcl_scr_syn_rulebreak_r_predicted <- predict(rulebreak_zinb_r,rulebreak_res,type="response")
#Incidence
rulebreak_res$incidence <- estimate.probability(rulebreak_res$cbcl_scr_syn_rulebreak_r, method="empirical")

#Plotting histogram of residuals, but may be skewed since using ZINB, so make sure to check below plots
hist(rulebreak_res$level1_resid.pearson)

### Incidence vs. X’s Plots

#age
ggplot(rulebreak_res,aes(incidence,interview_age)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : pseudoinverse used at 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : neighborhood radius 7.303e-05
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : reciprocal condition number 1.3261e-14
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : There are other near singularities as well. 1.3333e-09
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used at 0
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius
## 7.303e-05
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : reciprocal condition
## number 1.3261e-14
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : There are other near
## singularities as well. 1.3333e-09

#pm2.5
ggplot(rulebreak_res,aes(incidence,reshist_addr1_no2_2016_aavg_bl)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : pseudoinverse used at 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : neighborhood radius 7.303e-05
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : reciprocal condition number 1.3261e-14
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : There are other near singularities as well. 1.3333e-09
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used at 0
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius
## 7.303e-05
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : reciprocal condition
## number 1.3261e-14
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : There are other near
## singularities as well. 1.3333e-09

### Residuals vs Y (CBCL Outcome) Plot

plot(rulebreak_res$level1_resid.pearson, rulebreak_res$cbcl_scr_syn_rulebreak_r)

### Residuals vs Yhat Plot

plot(rulebreak_res$level1_resid.pearson, rulebreak_res$cbcl_scr_syn_rulebreak_r_predicted)

### Residuals vs Row Plot

plot(as.numeric(rownames(rulebreak_res)),rulebreak_res$level1_resid.pearson)

### Residuals vs X’s Plots

#age
ggplot(rulebreak_res,aes(level1_resid.pearson,interview_age)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

#pm2.5
ggplot(rulebreak_res,aes(level1_resid.pearson,reshist_addr1_no2_2016_aavg_bl)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

Aggressive

CBCL + AP Longitudinal Models

aggressive_zinb_r <- glmm.zinb(cbcl_scr_syn_aggressive_r ~ reshist_addr1_no2_2016_aavg_bl.c533*interview_age.c9.y + race_ethnicity.bl + high.educ.bl+ prnt.empl.bl  + neighb_phenx_avg_p.bl.cm + overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5, random = ~1|abcd_site/subjectid, 
              zi_fixed = ~ reshist_addr1_no2_2016_aavg_bl.c533*interview_age.c9.y + race_ethnicity.bl + high.educ.bl+ prnt.empl.bl  + neighb_phenx_avg_p.bl.cm + overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5, zi_random = ~1|abcd_site, data = df_cc)
## Computational iterations: 11 
## Computational time: 1.729 minutes
summary(aggressive_zinb_r)
## Linear mixed-effects model fit by maximum likelihood
##   Data: df_cc 
##   AIC BIC logLik
##    NA  NA     NA
## 
## Random effects:
##  Formula: ~1 | abcd_site
##         (Intercept)
## StdDev:   0.1351839
## 
##  Formula: ~1 | subjectid %in% abcd_site
##         (Intercept)  Residual
## StdDev:    1.145747 0.9761331
## 
## Variance function:
##  Structure: fixed weights
##  Formula: ~invwt 
## Fixed effects:  cbcl_scr_syn_aggressive_r ~ reshist_addr1_no2_2016_aavg_bl.c533 *      interview_age.c9.y + race_ethnicity.bl + high.educ.bl + prnt.empl.bl +      neighb_phenx_avg_p.bl.cm + overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5 
##                                                             Value  Std.Error
## (Intercept)                                             0.6855876 0.06747743
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.0009181 0.00380849
## interview_age.c9.y                                     -0.0130245 0.01276624
## race_ethnicity.blHispanic                              -0.0511886 0.04198411
## race_ethnicity.blBlack                                 -0.1872301 0.04674910
## race_ethnicity.blOther                                 -0.0839604 0.04281985
## high.educ.blBachelor                                    0.0865743 0.03580181
## high.educ.blSome College                                0.1510801 0.04084810
## high.educ.blHS Diploma/GED                              0.0255219 0.05734854
## high.educ.bl< HS Diploma                                0.0920724 0.07377912
## prnt.empl.blStay at Home Parent                         0.0253251 0.03624304
## prnt.empl.blUnemployed                                  0.2139679 0.05878831
## prnt.empl.blOther                                       0.1822468 0.05189938
## neighb_phenx_avg_p.bl.cm                               -0.1279770 0.01512550
## overall.income.bl[>=50K & <100K]                        0.1223104 0.03618373
## overall.income.bl[<50k]                                 0.2493145 0.04527164
## overall.income.bl[Don't Know or Refuse]                 0.1376904 0.05688751
## sex.blFemale                                           -0.2495197 0.02648157
## reshist_addr1_pm252016aa_bl.c5                         -0.0173275 0.01328447
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.0023343 0.00088651
##                                                           DF   t-value p-value
## (Intercept)                                            14510 10.160250  0.0000
## reshist_addr1_no2_2016_aavg_bl.c533                     9307 -0.241057  0.8095
## interview_age.c9.y                                     14510 -1.020233  0.3076
## race_ethnicity.blHispanic                               9307 -1.219238  0.2228
## race_ethnicity.blBlack                                  9307 -4.004998  0.0001
## race_ethnicity.blOther                                  9307 -1.960782  0.0499
## high.educ.blBachelor                                    9307  2.418154  0.0156
## high.educ.blSome College                                9307  3.698584  0.0002
## high.educ.blHS Diploma/GED                              9307  0.445031  0.6563
## high.educ.bl< HS Diploma                                9307  1.247947  0.2121
## prnt.empl.blStay at Home Parent                         9307  0.698757  0.4847
## prnt.empl.blUnemployed                                  9307  3.639634  0.0003
## prnt.empl.blOther                                       9307  3.511540  0.0004
## neighb_phenx_avg_p.bl.cm                                9307 -8.461010  0.0000
## overall.income.bl[>=50K & <100K]                        9307  3.380260  0.0007
## overall.income.bl[<50k]                                 9307  5.507079  0.0000
## overall.income.bl[Don't Know or Refuse]                 9307  2.420398  0.0155
## sex.blFemale                                            9307 -9.422388  0.0000
## reshist_addr1_pm252016aa_bl.c5                          9307 -1.304342  0.1921
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y 14510 -2.633146  0.0085
##  Correlation: 
##                                                        (Intr) rs_1_2_2016__.533
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.598                  
## interview_age.c9.y                                     -0.323  0.374           
## race_ethnicity.blHispanic                              -0.023 -0.055           
## race_ethnicity.blBlack                                 -0.020 -0.077           
## race_ethnicity.blOther                                 -0.083 -0.030           
## high.educ.blBachelor                                   -0.189  0.012           
## high.educ.blSome College                               -0.129  0.019           
## high.educ.blHS Diploma/GED                             -0.078  0.007           
## high.educ.bl< HS Diploma                               -0.030 -0.017           
## prnt.empl.blStay at Home Parent                        -0.084  0.005           
## prnt.empl.blUnemployed                                 -0.025 -0.011           
## prnt.empl.blOther                                      -0.037 -0.002           
## neighb_phenx_avg_p.bl.cm                               -0.182  0.089           
## overall.income.bl[>=50K & <100K]                       -0.127 -0.011           
## overall.income.bl[<50k]                                -0.064 -0.017           
## overall.income.bl[Don't Know or Refuse]                -0.060 -0.007           
## sex.blFemale                                           -0.183 -0.001           
## reshist_addr1_pm252016aa_bl.c5                         -0.317 -0.236           
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.296 -0.405           
##                                                        in_.9. rc_t.H rc_t.B
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                               0.000              
## race_ethnicity.blBlack                                  0.001  0.355       
## race_ethnicity.blOther                                  0.000  0.287  0.261
## high.educ.blBachelor                                   -0.004 -0.022 -0.017
## high.educ.blSome College                                0.000 -0.112 -0.086
## high.educ.blHS Diploma/GED                              0.002 -0.144 -0.148
## high.educ.bl< HS Diploma                               -0.005 -0.169 -0.078
## prnt.empl.blStay at Home Parent                         0.002  0.043  0.092
## prnt.empl.blUnemployed                                 -0.002  0.010 -0.041
## prnt.empl.blOther                                       0.002  0.040  0.011
## neighb_phenx_avg_p.bl.cm                               -0.004  0.029  0.137
## overall.income.bl[>=50K & <100K]                       -0.006 -0.087 -0.060
## overall.income.bl[<50k]                                -0.004 -0.141 -0.180
## overall.income.bl[Don't Know or Refuse]                -0.008 -0.095 -0.123
## sex.blFemale                                            0.002 -0.008 -0.018
## reshist_addr1_pm252016aa_bl.c5                         -0.006 -0.084 -0.031
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.923  0.003  0.003
##                                                        rc_t.O hgh..B hg..SC
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                   -0.003              
## high.educ.blSome College                               -0.026  0.461       
## high.educ.blHS Diploma/GED                             -0.010  0.339  0.502
## high.educ.bl< HS Diploma                               -0.013  0.268  0.413
## prnt.empl.blStay at Home Parent                         0.018 -0.031 -0.016
## prnt.empl.blUnemployed                                  0.011 -0.010 -0.011
## prnt.empl.blOther                                      -0.011 -0.014 -0.033
## neighb_phenx_avg_p.bl.cm                                0.041 -0.005  0.061
## overall.income.bl[>=50K & <100K]                       -0.010 -0.176 -0.276
## overall.income.bl[<50k]                                -0.079 -0.161 -0.417
## overall.income.bl[Don't Know or Refuse]                -0.055 -0.101 -0.253
## sex.blFemale                                           -0.019  0.014  0.021
## reshist_addr1_pm252016aa_bl.c5                         -0.026  0.001 -0.017
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.002  0.004  0.001
##                                                        h..HSD h..<HD p..aHP
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                0.381              
## prnt.empl.blStay at Home Parent                        -0.050 -0.095       
## prnt.empl.blUnemployed                                 -0.069 -0.099  0.149
## prnt.empl.blOther                                      -0.014 -0.020  0.159
## neighb_phenx_avg_p.bl.cm                                0.056  0.049  0.028
## overall.income.bl[>=50K & <100K]                       -0.174 -0.116 -0.028
## overall.income.bl[<50k]                                -0.367 -0.311 -0.052
## overall.income.bl[Don't Know or Refuse]                -0.240 -0.220 -0.075
## sex.blFemale                                            0.014 -0.005 -0.006
## reshist_addr1_pm252016aa_bl.c5                         -0.009 -0.017 -0.018
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.001  0.006  0.001
##                                                        prn..U prn..O n___..
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                       0.134              
## neighb_phenx_avg_p.bl.cm                                0.022  0.004       
## overall.income.bl[>=50K & <100K]                       -0.014 -0.048  0.080
## overall.income.bl[<50k]                                -0.100 -0.138  0.151
## overall.income.bl[Don't Know or Refuse]                -0.077 -0.097  0.083
## sex.blFemale                                            0.019  0.017  0.027
## reshist_addr1_pm252016aa_bl.c5                         -0.002 -0.001  0.062
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.003 -0.001  0.003
##                                                        o..[&< o..[<5 o..KoR
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                                          
## neighb_phenx_avg_p.bl.cm                                                   
## overall.income.bl[>=50K & <100K]                                           
## overall.income.bl[<50k]                                 0.508              
## overall.income.bl[Don't Know or Refuse]                 0.363  0.488       
## sex.blFemale                                           -0.005 -0.006  0.009
## reshist_addr1_pm252016aa_bl.c5                         -0.018 -0.031 -0.031
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.006  0.004  0.008
##                                                        sx.blF r_1_25
## reshist_addr1_no2_2016_aavg_bl.c533                                 
## interview_age.c9.y                                                  
## race_ethnicity.blHispanic                                           
## race_ethnicity.blBlack                                              
## race_ethnicity.blOther                                              
## high.educ.blBachelor                                                
## high.educ.blSome College                                            
## high.educ.blHS Diploma/GED                                          
## high.educ.bl< HS Diploma                                            
## prnt.empl.blStay at Home Parent                                     
## prnt.empl.blUnemployed                                              
## prnt.empl.blOther                                                   
## neighb_phenx_avg_p.bl.cm                                            
## overall.income.bl[>=50K & <100K]                                    
## overall.income.bl[<50k]                                             
## overall.income.bl[Don't Know or Refuse]                             
## sex.blFemale                                                        
## reshist_addr1_pm252016aa_bl.c5                         -0.004       
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.000  0.006
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -3.4078102 -0.7131608 -0.3394560  0.4062731  3.9975825 
## 
## Number of Observations: 23857
## Number of Groups: 
##                abcd_site subjectid %in% abcd_site 
##                       21                     9345
summary(aggressive_zinb_r$zi.fit)
## Linear mixed-effects model fit by maximum likelihood
##   Data: data 
##   AIC BIC logLik
##    NA  NA     NA
## 
## Random effects:
##  Formula: ~1 | abcd_site
##         (Intercept)  Residual
## StdDev:   0.2859857 0.4689479
## 
## Variance function:
##  Structure: fixed weights
##  Formula: ~invwt 
## Fixed effects:  zp ~ reshist_addr1_no2_2016_aavg_bl.c533 * interview_age.c9.y +      race_ethnicity.bl + high.educ.bl + prnt.empl.bl + neighb_phenx_avg_p.bl.cm +      overall.income.bl + sex.bl + reshist_addr1_pm252016aa_bl.c5 
##                                                            Value  Std.Error
## (Intercept)                                            -4.464757 0.13898278
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.003421 0.00834420
## interview_age.c9.y                                      0.261613 0.04528161
## race_ethnicity.blHispanic                               0.348753 0.05979107
## race_ethnicity.blBlack                                  0.725354 0.06155347
## race_ethnicity.blOther                                  0.467685 0.05663682
## high.educ.blBachelor                                    0.136341 0.04985510
## high.educ.blSome College                                0.234711 0.05831398
## high.educ.blHS Diploma/GED                              0.379336 0.08018152
## high.educ.bl< HS Diploma                                1.010817 0.08734638
## prnt.empl.blStay at Home Parent                        -0.028632 0.05173440
## prnt.empl.blUnemployed                                  0.228653 0.07369051
## prnt.empl.blOther                                      -0.164570 0.07951712
## neighb_phenx_avg_p.bl.cm                                0.263897 0.02232451
## overall.income.bl[>=50K & <100K]                       -0.297203 0.05201787
## overall.income.bl[<50k]                                -0.532671 0.06533646
## overall.income.bl[Don't Know or Refuse]                 0.043443 0.07168271
## sex.blFemale                                            0.200690 0.03650075
## reshist_addr1_pm252016aa_bl.c5                          0.069745 0.01932826
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.001164 0.00319674
##                                                           DF   t-value p-value
## (Intercept)                                            23817 -32.12453  0.0000
## reshist_addr1_no2_2016_aavg_bl.c533                    23817  -0.41000  0.6818
## interview_age.c9.y                                     23817   5.77746  0.0000
## race_ethnicity.blHispanic                              23817   5.83286  0.0000
## race_ethnicity.blBlack                                 23817  11.78414  0.0000
## race_ethnicity.blOther                                 23817   8.25762  0.0000
## high.educ.blBachelor                                   23817   2.73475  0.0062
## high.educ.blSome College                               23817   4.02495  0.0001
## high.educ.blHS Diploma/GED                             23817   4.73096  0.0000
## high.educ.bl< HS Diploma                               23817  11.57251  0.0000
## prnt.empl.blStay at Home Parent                        23817  -0.55343  0.5800
## prnt.empl.blUnemployed                                 23817   3.10288  0.0019
## prnt.empl.blOther                                      23817  -2.06961  0.0385
## neighb_phenx_avg_p.bl.cm                               23817  11.82096  0.0000
## overall.income.bl[>=50K & <100K]                       23817  -5.71347  0.0000
## overall.income.bl[<50k]                                23817  -8.15274  0.0000
## overall.income.bl[Don't Know or Refuse]                23817   0.60604  0.5445
## sex.blFemale                                           23817   5.49823  0.0000
## reshist_addr1_pm252016aa_bl.c5                         23817   3.60847  0.0003
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y 23817  -0.36399  0.7159
##  Correlation: 
##                                                        (Intr) rs_1_2_2016__.533
## reshist_addr1_no2_2016_aavg_bl.c533                    -0.701                  
## interview_age.c9.y                                     -0.659  0.721           
## race_ethnicity.blHispanic                              -0.041 -0.044           
## race_ethnicity.blBlack                                 -0.031 -0.067           
## race_ethnicity.blOther                                 -0.088 -0.024           
## high.educ.blBachelor                                   -0.135 -0.002           
## high.educ.blSome College                               -0.096  0.008           
## high.educ.blHS Diploma/GED                             -0.065  0.000           
## high.educ.bl< HS Diploma                               -0.019 -0.032           
## prnt.empl.blStay at Home Parent                        -0.065 -0.001           
## prnt.empl.blUnemployed                                 -0.024 -0.010           
## prnt.empl.blOther                                      -0.026  0.000           
## neighb_phenx_avg_p.bl.cm                               -0.150  0.065           
## overall.income.bl[>=50K & <100K]                       -0.058 -0.022           
## overall.income.bl[<50k]                                -0.021 -0.026           
## overall.income.bl[Don't Know or Refuse]                -0.018 -0.024           
## sex.blFemale                                           -0.145  0.005           
## reshist_addr1_pm252016aa_bl.c5                         -0.225 -0.175           
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.600 -0.785           
##                                                        in_.9. rc_t.H rc_t.B
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                               0.002              
## race_ethnicity.blBlack                                  0.011  0.409       
## race_ethnicity.blOther                                  0.007  0.341  0.309
## high.educ.blBachelor                                   -0.014 -0.005 -0.003
## high.educ.blSome College                               -0.003 -0.114 -0.093
## high.educ.blHS Diploma/GED                              0.009 -0.142 -0.145
## high.educ.bl< HS Diploma                               -0.016 -0.169 -0.090
## prnt.empl.blStay at Home Parent                        -0.002  0.048  0.101
## prnt.empl.blUnemployed                                 -0.001  0.018 -0.027
## prnt.empl.blOther                                       0.010  0.043  0.002
## neighb_phenx_avg_p.bl.cm                               -0.001  0.016  0.122
## overall.income.bl[>=50K & <100K]                       -0.013 -0.098 -0.087
## overall.income.bl[<50k]                                -0.011 -0.133 -0.200
## overall.income.bl[Don't Know or Refuse]                -0.021 -0.107 -0.144
## sex.blFemale                                            0.009 -0.004 -0.024
## reshist_addr1_pm252016aa_bl.c5                         -0.015 -0.059 -0.024
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.917  0.005  0.003
##                                                        rc_t.O hgh..B hg..SC
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                    0.018              
## high.educ.blSome College                               -0.005  0.452       
## high.educ.blHS Diploma/GED                              0.005  0.339  0.507
## high.educ.bl< HS Diploma                                0.002  0.317  0.491
## prnt.empl.blStay at Home Parent                         0.020 -0.029 -0.017
## prnt.empl.blUnemployed                                  0.014 -0.015 -0.009
## prnt.empl.blOther                                      -0.019 -0.020 -0.029
## neighb_phenx_avg_p.bl.cm                                0.027  0.002  0.055
## overall.income.bl[>=50K & <100K]                       -0.022 -0.154 -0.292
## overall.income.bl[<50k]                                -0.075 -0.138 -0.397
## overall.income.bl[Don't Know or Refuse]                -0.061 -0.105 -0.291
## sex.blFemale                                           -0.012  0.012  0.017
## reshist_addr1_pm252016aa_bl.c5                         -0.007  0.005 -0.010
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.005  0.013  0.006
##                                                        h..HSD h..<HD p..aHP
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                0.476              
## prnt.empl.blStay at Home Parent                        -0.051 -0.113       
## prnt.empl.blUnemployed                                 -0.080 -0.130  0.176
## prnt.empl.blOther                                      -0.012 -0.030  0.144
## neighb_phenx_avg_p.bl.cm                                0.047  0.061  0.029
## overall.income.bl[>=50K & <100K]                       -0.188 -0.148 -0.022
## overall.income.bl[<50k]                                -0.379 -0.387 -0.047
## overall.income.bl[Don't Know or Refuse]                -0.293 -0.312 -0.090
## sex.blFemale                                            0.011 -0.004  0.004
## reshist_addr1_pm252016aa_bl.c5                          0.004 -0.022 -0.005
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.000  0.025  0.011
##                                                        prn..U prn..O n___..
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                       0.140              
## neighb_phenx_avg_p.bl.cm                                0.033 -0.008       
## overall.income.bl[>=50K & <100K]                       -0.017 -0.046  0.073
## overall.income.bl[<50k]                                -0.097 -0.124  0.130
## overall.income.bl[Don't Know or Refuse]                -0.099 -0.112  0.089
## sex.blFemale                                            0.036  0.013  0.023
## reshist_addr1_pm252016aa_bl.c5                          0.003  0.006  0.048
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.006 -0.006  0.002
##                                                        o..[&< o..[<5 o..KoR
## reshist_addr1_no2_2016_aavg_bl.c533                                        
## interview_age.c9.y                                                         
## race_ethnicity.blHispanic                                                  
## race_ethnicity.blBlack                                                     
## race_ethnicity.blOther                                                     
## high.educ.blBachelor                                                       
## high.educ.blSome College                                                   
## high.educ.blHS Diploma/GED                                                 
## high.educ.bl< HS Diploma                                                   
## prnt.empl.blStay at Home Parent                                            
## prnt.empl.blUnemployed                                                     
## prnt.empl.blOther                                                          
## neighb_phenx_avg_p.bl.cm                                                   
## overall.income.bl[>=50K & <100K]                                           
## overall.income.bl[<50k]                                 0.475              
## overall.income.bl[Don't Know or Refuse]                 0.392  0.556       
## sex.blFemale                                            0.001  0.000  0.001
## reshist_addr1_pm252016aa_bl.c5                         -0.012 -0.020 -0.036
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.014  0.011  0.029
##                                                        sx.blF r_1_25
## reshist_addr1_no2_2016_aavg_bl.c533                                 
## interview_age.c9.y                                                  
## race_ethnicity.blHispanic                                           
## race_ethnicity.blBlack                                              
## race_ethnicity.blOther                                              
## high.educ.blBachelor                                                
## high.educ.blSome College                                            
## high.educ.blHS Diploma/GED                                          
## high.educ.bl< HS Diploma                                            
## prnt.empl.blStay at Home Parent                                     
## prnt.empl.blUnemployed                                              
## prnt.empl.blOther                                                   
## neighb_phenx_avg_p.bl.cm                                            
## overall.income.bl[>=50K & <100K]                                    
## overall.income.bl[<50k]                                             
## overall.income.bl[Don't Know or Refuse]                             
## sex.blFemale                                                        
## reshist_addr1_pm252016aa_bl.c5                         -0.006       
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y -0.003  0.016
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -1.2606977 -0.3647646 -0.2733282  0.2186763 19.2682499 
## 
## Number of Observations: 23857
## Number of Groups: 21
anova(aggressive_zinb_r)
##                                                        numDF denDF  F-value
## (Intercept)                                                1 14510 342.5889
## reshist_addr1_no2_2016_aavg_bl.c533                        1  9307   0.0336
## interview_age.c9.y                                         1 14510  81.7451
## race_ethnicity.bl                                          3  9307   2.5127
## high.educ.bl                                               4  9307  21.8311
## prnt.empl.bl                                               3  9307  13.1074
## neighb_phenx_avg_p.bl.cm                                   1  9307  82.3797
## overall.income.bl                                          3  9307   9.9956
## sex.bl                                                     1  9307  88.8603
## reshist_addr1_pm252016aa_bl.c5                             1  9307   1.6615
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y     1 14510   6.9335
##                                                        p-value
## (Intercept)                                             <.0001
## reshist_addr1_no2_2016_aavg_bl.c533                     0.8546
## interview_age.c9.y                                      <.0001
## race_ethnicity.bl                                       0.0567
## high.educ.bl                                            <.0001
## prnt.empl.bl                                            <.0001
## neighb_phenx_avg_p.bl.cm                                <.0001
## overall.income.bl                                       <.0001
## sex.bl                                                  <.0001
## reshist_addr1_pm252016aa_bl.c5                          0.1974
## reshist_addr1_no2_2016_aavg_bl.c533:interview_age.c9.y  0.0085

Assumption checking for ZINB Models

#Check outlier/residuals with this df
aggressive_res <- df_cc
aggressive_res$level1_resid.raw <- residuals(aggressive_zinb_r)
aggressive_res$level1_resid.pearson <- residuals(aggressive_zinb_r, type="pearson")
#Add predicted values (Yhat)
aggressive_res$cbcl_scr_syn_aggressive_r_predicted <- predict(aggressive_zinb_r,aggressive_res,type="response")
#Incidence
aggressive_res$incidence <- estimate.probability(aggressive_res$cbcl_scr_syn_aggressive_r, method="empirical")

#Plotting histogram of residuals, but may be skewed since using ZINB, so make sure to check below plots
hist(aggressive_res$level1_resid.pearson)

### Incidence vs. X’s Plots

#age
ggplot(aggressive_res,aes(incidence,interview_age)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

#pm2.5
ggplot(aggressive_res,aes(incidence,reshist_addr1_no2_2016_aavg_bl)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

### Residuals vs Y (CBCL Outcome) Plot

plot(aggressive_res$level1_resid.pearson, aggressive_res$cbcl_scr_syn_aggressive_r)

### Residuals vs Yhat Plot

plot(aggressive_res$level1_resid.pearson, aggressive_res$cbcl_scr_syn_aggressive_r_predicted)

### Residuals vs Row Plot

plot(as.numeric(rownames(aggressive_res)),aggressive_res$level1_resid.pearson)

### Residuals vs X’s Plots

#age
ggplot(aggressive_res,aes(level1_resid.pearson,interview_age)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'

#pm2.5
ggplot(aggressive_res,aes(level1_resid.pearson,reshist_addr1_no2_2016_aavg_bl)) + geom_point(color = "black") + geom_smooth(method = "loess")
## `geom_smooth()` using formula = 'y ~ x'